@Test
public void eagerUserServices() {
boolean pass = true;
// satisfies getEagerUser
// satisfies getUserByUsername
User user;
try {
user = userService.createEagerUser(username, password, email);
} catch (UserServiceException e) {
pass = false;
user = new User();
exceptions.add(e);
}
pass = (pass &&
username.equals(user.getUsername()) &&
password.equals(user.getPassword()) &&
email.equals(user.getEmail()));
id = user.getId();
// satisfies removeUserByUsername
try {
userService.removeUserByUsername(user.getUsername());
} catch (UserServiceException e) {
pass = false;
exceptions.add(e);
}
User userRemoved = null;
try {
userRemoved = userService.getUserById(id);
} catch (UserServiceException e ) {
pass = false;
exceptions.add(e);
}
pass = (pass && userRemoved == null); // expect null
// satisfies removeUserByEmail
try {
user = userService.createEagerUser(username, password, email);
} catch (UserServiceException e) {
pass = false;
user = new User();
exceptions.add(e);
}
try {
userService.removeUserByEmail(email);
} catch (UserServiceException e) {