Added test UserServiceTest - shouldCreateUser shouldReturnExistingUser
Signed-off-by: Marcin Woźniak <y0rune@aol.com>
This commit is contained in:
parent
453907782a
commit
f4db74b899
@ -82,4 +82,21 @@ public class UserServiceTest {
|
|||||||
private boolean containsName(final List<User> list, final String name) {
|
private boolean containsName(final List<User> list, final String name) {
|
||||||
return list.stream().map(User::getName).filter(name::equals).findFirst().isPresent();
|
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");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user