use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersServiceTest method testDeleteIdentifiedModel.
@Test
public void testDeleteIdentifiedModel() throws Exception {
final UserModelInterface userModel = Models.createUserModel(1, "FirstName", "LastName", "Surname", "email@gmail.com", "hash", true, 1);
this.usersService.delete(userModel);
verify(this.usersMapper, times(1)).delete(this.mapUserEntity(userModel));
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class SubjectsServiceTest method createSubjectModel.
private SubjectModelInterface createSubjectModel(Integer id, String name, String description, Integer userId, Integer issueStandardId) {
final SubjectModelInterface subjectModel = new SubjectModel();
subjectModel.setId(id);
subjectModel.setName(name);
subjectModel.setDescription(description);
final UserModelInterface userModel = Mockito.mock(UserModelInterface.class);
Mockito.when(userModel.getId()).thenReturn(userId);
final IssueStandardModelInterface issueStandardModel = Mockito.mock(IssueStandardModelInterface.class);
Mockito.when(issueStandardModel.getId()).thenReturn(issueStandardId);
subjectModel.setUser(userModel);
subjectModel.setIssueStandard(issueStandardModel);
return subjectModel;
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class SubjectsServiceTest method testFindByUserWithOptions.
@Test
public void testFindByUserWithOptions() throws Exception {
final Integer userId = 7;
final UserModelInterface userModel = Mockito.mock(UserModelInterface.class);
final SubjectEntity subjectEntityFirst = this.createSubjectEntityMock(3, "test3", "description3", userId);
final SubjectEntity subjectEntitySecond = this.createSubjectEntityMock(12, "test12", "description12", userId);
final List<SubjectEntity> subjectsEntities = new ArrayList<>();
subjectsEntities.add(subjectEntityFirst);
subjectsEntities.add(subjectEntitySecond);
given(userModel.getId()).willReturn(userId);
given(this.subjectsMapper.findByUserId(userId)).willReturn(subjectsEntities);
final List<SubjectModelInterface> subjectsModels = new ArrayList<>();
subjectsModels.add(this.mapSubjectModel(subjectEntityFirst));
subjectsModels.add(this.mapSubjectModel(subjectEntitySecond));
final SubjectsOptionsInterface subjectOptions = Mockito.mock(SubjectsOptionsInterface.class);
given(subjectOptions.withRelations(subjectsModels)).willReturn(subjectsModels);
final List<SubjectModelInterface> foundedSubjectsModels = this.subjectsService.findByUser(userModel, subjectOptions);
verify(this.subjectsMapper).findByUserId(userId);
verify(subjectOptions).withRelations(subjectsModels);
Assert.assertEquals(subjectsModels, foundedSubjectsModels);
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersServiceTest method testDeleteUnidentifiedModel.
@Test
public void testDeleteUnidentifiedModel() throws Exception {
final UserModelInterface userModel = Models.createUserModel(null, "FirstName", "LastName", "Surname", "email@gmail.com", "hash", true, 1);
exception.expect(DeleteUnidentifiedModelException.class);
this.usersService.delete(userModel);
}
use of easytests.core.models.UserModelInterface in project easy-tests by malinink.
the class UsersServiceTest method testFindPresentModel.
@Test
public void testFindPresentModel() throws Exception {
final Integer id = 1;
final UserModelInterface userModel = Models.createUserModel(id, "FirstName1", "LastName1", "Surname1", "email1@gmail.com", "hash1", true, 1);
final UserModelInterface foundedUserModel = this.usersService.find(id);
Assert.assertEquals(userModel, foundedUserModel);
}
Aggregations