use of easytests.core.entities.UserEntity in project easy-tests by malinink.
the class UsersMapperTest method testUpdate.
@Test
public void testUpdate() throws Exception {
final Integer id = 1;
final String firstName = "NewFirstName";
final String lastName = "NewLastName";
final String surname = "NewSurname";
final String email = "new.email@gmail.com";
final String password = "new.hash";
final Boolean isAdmin = false;
final Integer state = 2;
UserEntity userEntity = this.usersMapper.find(id);
Assert.assertNotNull(userEntity);
Assert.assertEquals(id, userEntity.getId());
Assert.assertNotEquals(firstName, userEntity.getFirstName());
Assert.assertNotEquals(lastName, userEntity.getLastName());
Assert.assertNotEquals(surname, userEntity.getSurname());
Assert.assertNotEquals(email, userEntity.getEmail());
Assert.assertNotEquals(password, userEntity.getPassword());
Assert.assertNotEquals(isAdmin, userEntity.getIsAdmin());
Assert.assertNotEquals(state, userEntity.getState());
userEntity = Mockito.mock(UserEntity.class);
Mockito.when(userEntity.getId()).thenReturn(id);
Mockito.when(userEntity.getFirstName()).thenReturn(firstName);
Mockito.when(userEntity.getLastName()).thenReturn(lastName);
Mockito.when(userEntity.getSurname()).thenReturn(surname);
Mockito.when(userEntity.getEmail()).thenReturn(email);
Mockito.when(userEntity.getPassword()).thenReturn(password);
Mockito.when(userEntity.getIsAdmin()).thenReturn(isAdmin);
Mockito.when(userEntity.getState()).thenReturn(state);
this.usersMapper.update(userEntity);
userEntity = this.usersMapper.find(id);
Assert.assertEquals(id, userEntity.getId());
Assert.assertEquals(firstName, userEntity.getFirstName());
Assert.assertEquals(lastName, userEntity.getLastName());
Assert.assertEquals(surname, userEntity.getSurname());
Assert.assertEquals(email, userEntity.getEmail());
Assert.assertEquals(password, userEntity.getPassword());
Assert.assertEquals(isAdmin, userEntity.getIsAdmin());
Assert.assertEquals(state, userEntity.getState());
}
use of easytests.core.entities.UserEntity in project easy-tests by malinink.
the class UsersMapperTest method testFind.
@Test
public void testFind() throws Exception {
final UserEntity userEntity = this.usersMapper.find(1);
Assert.assertEquals((Integer) 1, userEntity.getId());
Assert.assertEquals("FirstName1", userEntity.getFirstName());
Assert.assertEquals("LastName1", userEntity.getLastName());
Assert.assertEquals("Surname1", userEntity.getSurname());
Assert.assertEquals("email1@gmail.com", userEntity.getEmail());
Assert.assertEquals("hash1", userEntity.getPassword());
Assert.assertEquals(true, userEntity.getIsAdmin());
Assert.assertEquals((Integer) 1, userEntity.getState());
}
use of easytests.core.entities.UserEntity in project easy-tests by malinink.
the class UsersSupport method getEntityMock.
private UserEntity getEntityMock(Integer id, String firstName, String lastName, String surname, String email, String password, Boolean isAdmin, Integer state) {
final UserEntity userEntity = Mockito.mock(UserEntity.class);
Mockito.when(userEntity.getId()).thenReturn(id);
Mockito.when(userEntity.getFirstName()).thenReturn(firstName);
Mockito.when(userEntity.getLastName()).thenReturn(lastName);
Mockito.when(userEntity.getSurname()).thenReturn(surname);
Mockito.when(userEntity.getEmail()).thenReturn(email);
Mockito.when(userEntity.getPassword()).thenReturn(password);
Mockito.when(userEntity.getIsAdmin()).thenReturn(isAdmin);
Mockito.when(userEntity.getState()).thenReturn(state);
return userEntity;
}
use of easytests.core.entities.UserEntity in project easy-tests by malinink.
the class UsersMapperTest method testFindAll.
@Test
public void testFindAll() throws Exception {
final List<UserEntity> usersFoundedEntities = this.usersMapper.findAll();
Assert.assertEquals(3, usersFoundedEntities.size());
Integer index = 0;
for (UserEntity userEntity : usersFoundedEntities) {
final UserEntity userFixtureEntity = this.usersSupport.getEntityFixtureMock(index);
this.usersSupport.assertEquals(userFixtureEntity, userEntity);
index++;
}
}
use of easytests.core.entities.UserEntity in project easy-tests by malinink.
the class UsersService method map.
private UserEntity map(UserModelInterface userModel) {
final UserEntity userEntity = new UserEntity();
userEntity.map(userModel);
return userEntity;
}
Aggregations