Search in sources :

Example 1 with UserModelEmpty

use of easytests.core.models.empty.UserModelEmpty in project easy-tests by malinink.

the class SubjectsSupport method assertEquals.

public void assertEquals(SubjectEntity expected, SubjectModelInterface actual) {
    assertEquals(actual, expected);
    Assert.assertEquals(new UserModelEmpty(expected.getUserId()), actual.getUser());
    Assert.assertEquals(new ModelsListEmpty(), actual.getTopics());
    Assert.assertEquals(new IssueStandardModelEmpty(), actual.getIssueStandard());
    Assert.assertEquals(new ModelsListEmpty(), actual.getIssues());
}
Also used : ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserModelEmpty(easytests.core.models.empty.UserModelEmpty) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty)

Example 2 with UserModelEmpty

use of easytests.core.models.empty.UserModelEmpty in project easy-tests by malinink.

the class SubjectsServiceTest method testSaveModel.

@Test
public void testSaveModel() throws Exception {
    final SubjectModelInterface subjectModel = new SubjectModel();
    subjectModel.setName("test111");
    subjectModel.setTopics(new ModelsListEmpty());
    subjectModel.setIssueStandard(new IssueStandardModelEmpty());
    subjectModel.setUser(new UserModelEmpty(1));
    subjectModel.setIssues(new ModelsListEmpty());
    this.subjectsService.save(subjectModel);
    final SubjectModelInterface foundedSubjectModel = this.subjectsService.find(subjectModel.getId());
    Assert.assertEquals(subjectModel, foundedSubjectModel);
}
Also used : ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserModelEmpty(easytests.core.models.empty.UserModelEmpty) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with UserModelEmpty

use of easytests.core.models.empty.UserModelEmpty in project easy-tests by malinink.

the class SubjectModel method map.

public void map(SubjectEntity subjectEntity) {
    this.setId(subjectEntity.getId());
    this.setName(subjectEntity.getName());
    this.setDescription(subjectEntity.getDescription());
    this.setTopics(new ModelsListEmpty());
    this.setUser(new UserModelEmpty(subjectEntity.getUserId()));
    this.setIssueStandard(new IssueStandardModelEmpty());
    this.setIssues(new ModelsListEmpty());
}
Also used : ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserModelEmpty(easytests.core.models.empty.UserModelEmpty) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty)

Example 4 with UserModelEmpty

use of easytests.core.models.empty.UserModelEmpty in project easy-tests by malinink.

the class SubjectModelTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer subjectId = 5;
    final String subjectName = "Test subject";
    final String subjectDescription = "Test subject description";
    final Integer subjectUserId = 3;
    final SubjectEntity subjectEntity = Mockito.mock(SubjectEntity.class);
    Mockito.when(subjectEntity.getId()).thenReturn(subjectId);
    Mockito.when(subjectEntity.getName()).thenReturn(subjectName);
    Mockito.when(subjectEntity.getDescription()).thenReturn(subjectDescription);
    Mockito.when(subjectEntity.getUserId()).thenReturn(subjectUserId);
    final SubjectModelInterface subjectModel = new SubjectModel();
    subjectModel.map(subjectEntity);
    Assert.assertEquals(subjectId, subjectModel.getId());
    Assert.assertEquals(subjectName, subjectModel.getName());
    Assert.assertEquals(subjectDescription, subjectModel.getDescription());
    Assert.assertEquals(new ModelsListEmpty(), subjectModel.getTopics());
    Assert.assertEquals(new UserModelEmpty(subjectUserId), subjectModel.getUser());
    Assert.assertEquals(new IssueStandardModelEmpty(), subjectModel.getIssueStandard());
    Assert.assertEquals(new ModelsListEmpty(), subjectModel.getIssues());
}
Also used : SubjectEntity(easytests.core.entities.SubjectEntity) ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserModelEmpty(easytests.core.models.empty.UserModelEmpty) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) Test(org.junit.Test)

Example 5 with UserModelEmpty

use of easytests.core.models.empty.UserModelEmpty in project easy-tests by malinink.

the class SubjectEntityTest method testMap.

@Test
public void testMap() throws Exception {
    final Integer subjectId = 5;
    final String subjectName = "Test subject";
    final Integer subjectUserId = 1;
    final SubjectModelInterface subjectModel = Mockito.mock(SubjectModelInterface.class);
    Mockito.when(subjectModel.getId()).thenReturn(subjectId);
    Mockito.when(subjectModel.getName()).thenReturn(subjectName);
    Mockito.when(subjectModel.getTopics()).thenReturn(new ModelsListEmpty());
    Mockito.when(subjectModel.getUser()).thenReturn(new UserModelEmpty(subjectUserId));
    Mockito.when(subjectModel.getIssueStandard()).thenReturn(new IssueStandardModelEmpty());
    Mockito.when(subjectModel.getIssues()).thenReturn(new ModelsListEmpty());
    final SubjectEntity subjectEntity = new SubjectEntity();
    subjectEntity.map(subjectModel);
    Assert.assertEquals(subjectId, subjectEntity.getId());
    Assert.assertEquals(subjectName, subjectEntity.getName());
    Assert.assertEquals(subjectUserId, subjectEntity.getUserId());
}
Also used : ModelsListEmpty(easytests.core.models.empty.ModelsListEmpty) UserModelEmpty(easytests.core.models.empty.UserModelEmpty) IssueStandardModelEmpty(easytests.core.models.empty.IssueStandardModelEmpty) SubjectModelInterface(easytests.core.models.SubjectModelInterface) Test(org.junit.Test)

Aggregations

UserModelEmpty (easytests.core.models.empty.UserModelEmpty)9 IssueStandardModelEmpty (easytests.core.models.empty.IssueStandardModelEmpty)7 ModelsListEmpty (easytests.core.models.empty.ModelsListEmpty)7 Test (org.junit.Test)5 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 SubjectModelInterface (easytests.core.models.SubjectModelInterface)2 ArrayList (java.util.ArrayList)2 SubjectEntity (easytests.core.entities.SubjectEntity)1