Added test UserServiceTest - shouldCreateUser shouldReturnExistingUser

Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
Marcin Woźniak 2020-12-03 17:07:41 +01:00
parent 453907782a
commit f4db74b899
Signed by: y0rune
GPG Key ID: F204C385F57EB348

View File

@ -82,4 +82,21 @@ public class UserServiceTest {
private boolean containsName(final List<User> list, final String name) {
return list.stream().map(User::getName).filter(name::equals).findFirst().isPresent();
}
@Test
public void shouldCreateUser(){
final User user = this.userService.checkForUser("shouldCreateUser@UserService.test", null);
assertTrue(user.getId() != null);
}
@Test
public void shouldReturnExistingUser(){
final String email = "shouldReturnExistingUser@UserService.test";
this.userService.save(new User("Tom","Smieszne",email,UserRoles.TEST_USER));
final User user = this.userService.checkForUser(email, null);
assertTrue(user.getName() != "Tom");
}
}