private void checkForm(UserForm userForm) { assert userForm != null; assert userForm.getUsername() != null; assert userForm.getPassword() != null; }
public String getMessage() { return messageService.getMessage(); } }
public void logout(UserForm userForm) { System.out.println("LoginService.logout " + userForm); // Preconditions checkForm(userForm); // Same user cannot be logged twice String username = userForm.getUsername(); if (!usersLogged.contains(username)) { throw new LoginException(username + " not logged"); } usersLogged.remove(username); }
public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); // Preconditions checkForm(userForm); // Same user cannot be logged twice String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } // Call to repository to make logic boolean login = loginRepository.login(userForm); if (login) { usersLogged.add(username); } return login; }
@PostConstruct private void populateLibrary() { addBook(new Book("The Hobbit", "J. R. R. Tolkien", LocalDate.of(1937, 2, 21))); addBook(new Book("A Confederacy of Dunces", "John Kennedy Toole", LocalDate.of(1980, 4, 1))); addBook(new Book("A Game of Thrones (A Song of Ice and Fire)", "George R.R. Martin", LocalDate.of(1996, 1, 1))); }
@Functional class FunctionalTest { @Test void testOne() { System.out.println("Functional Test 1"); } @Test void testTwo() { System.out.println("Functional Test 2"); } }
@Override public Stream<TestTemplateInvocationContext> provideTestTemplateInvocationContexts( ExtensionContext context) { return Stream.of(invocationContext("parameter-1"), invocationContext("parameter-2")); }
public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); // Preconditions checkForm(userForm); // Same user cannot be logged twice String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } // Call to repository to make logic boolean login = loginRepository.login(userForm); if (login) { usersLogged.add(username); } return login; }
public void logout(UserForm userForm) { System.out.println("LoginService.logout " + userForm); // Preconditions checkForm(userForm); // Same user cannot be logged twice String username = userForm.getUsername(); if (!usersLogged.contains(username)) { throw new LoginException(username + " not logged"); } usersLogged.remove(username); }
public String getMessage() { return messageService.getMessage(); } }
private void checkForm(UserForm userForm) { assert userForm != null; assert userForm.getUsername() != null; assert userForm.getPassword() != null; }
@Functional class FunctionalTest { @Test void testOne() { System.out.println("Functional Test 1"); } @Test void testTwo() { System.out.println("Functional Test 2"); } }
public boolean login(UserForm userForm) { System.out.println("LoginService.login " + userForm); // Preconditions checkForm(userForm); // Same user cannot be logged twice String username = userForm.getUsername(); if (usersLogged.contains(username)) { throw new LoginException(username + " already logged"); } // Call to repository to make logic boolean login = loginRepository.login(userForm); if (login) { usersLogged.add(username); } return login; }
public void logout(UserForm userForm) { System.out.println("LoginService.logout " + userForm); // Preconditions checkForm(userForm); // Same user cannot be logged twice String username = userForm.getUsername(); if (!usersLogged.contains(username)) { throw new LoginException(username + " not logged"); } usersLogged.remove(username); }
public String getMessage() { return messageService.getMessage(); } }
private void checkForm(UserForm userForm) { assert userForm != null; assert userForm.getUsername() != null; assert userForm.getPassword() != null; }
public String getMessage() { return messageService.getMessage(); }
public String getMessage() { return messageService.getMessage(); }