use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserServiceImplTest method testFindUsersByDisplayNamePartial_blackbox_shouldReturnExpectedResults.
@Test
public void testFindUsersByDisplayNamePartial_blackbox_shouldReturnExpectedResults() throws Exception {
UserServiceImpl fixture = UserServiceImplFactory.createUsersServiceImpl();
PagerParams pagerParams = new PagerParams(20, 40);
PaginatedList<User> resultFromDao = new PaginatedList<User>();
resultFromDao.setTotalResults(1);
resultFromDao.setPagerParams(pagerParams);
resultFromDao.setItems(new LinkedList<User>());
resultFromDao.getItems().add(UserFactory.createNewUserTemplate());
when(fixture.getUserDao().findUserByDisplayNamePartial("asd", pagerParams)).thenReturn(resultFromDao);
PaginatedList<User> results = fixture.findUsersByDisplayNamePartial("asd", pagerParams);
assertNotNull(results);
assertNotNull(results.getPagerParams());
assertEquals(pagerParams.getOffset(), results.getPagerParams().getOffset());
assertEquals(pagerParams.getMax(), results.getPagerParams().getMax());
assertEquals(1, results.getTotalResults());
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserServiceImplTest method testCreateUser_whitebox_expectOurExceptionInsteadOfUnexpectedOne.
@Test(expected = UserServiceUnexpectedException.class)
public void testCreateUser_whitebox_expectOurExceptionInsteadOfUnexpectedOne() throws Exception {
UserServiceImpl fixture = UserServiceImplFactory.createUsersServiceImpl();
User user = UserFactory.createNewUserTemplate();
doThrow(new IllegalArgumentException("test exception")).when(fixture.getUserDao()).createUser(any(User.class));
fixture.createUser(user);
fail();
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserServiceImplTest method testCreateUser_whitebox_expectReturnedValueIsNotTheSameReferenceAsParameter.
@Test
public void testCreateUser_whitebox_expectReturnedValueIsNotTheSameReferenceAsParameter() throws Exception {
UserServiceImpl fixture = UserServiceImplFactory.createUsersServiceImpl();
User template = UserFactory.createNewUserTemplate();
User result = fixture.createUser(template);
// add additional test code here
assertNotNull(result);
assertNotSame(template, result);
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class UserServiceImplTest method testCreateUser_blackbox_expectAllFieldsEqualsForCreatedUser.
@Test
public void testCreateUser_blackbox_expectAllFieldsEqualsForCreatedUser() throws Exception {
UserServiceImpl fixture = UserServiceImplFactory.createUsersServiceImpl();
User user = UserFactory.createNewUserTemplate();
User createdUser = fixture.createUser(user);
// add additional test code here
assertNotNull(createdUser);
assertEquals(createdUser.getDisplayName(), user.getDisplayName());
assertEquals(createdUser.getEmail(), user.getEmail());
assertEquals(createdUser.getIntegrationData(), user.getIntegrationData());
assertEquals(createdUser.getIsBlocked(), user.getIsBlocked());
assertEquals(createdUser.getLocale(), user.getLocale());
assertEquals(createdUser.getRegisteredAt(), user.getRegisteredAt());
assertEquals(createdUser.getTimeZone(), user.getTimeZone());
}
use of org.summerb.microservices.users.api.dto.User in project summerb by skarpushin.
the class SecurityMailsMessageBuilderFactoryImpl method getAccountOperationsSender.
@Override
public User getAccountOperationsSender() {
if (registrationEmailSender == null) {
registrationEmailSender = new User();
registrationEmailSender.setEmail(emailSenderAddress);
registrationEmailSender.setDisplayName(emailSenderName);
}
return registrationEmailSender;
}
Aggregations