Search in sources :

Example 1 with SourceTeeth

use of org.mapstruct.ap.test.collection.adder.source.SourceTeeth in project mapstruct by mapstruct.

the class AdderTest method testShouldFallBackToDaliSingularInAbsenceOfHumanSingular.

@ProcessorTest
public void testShouldFallBackToDaliSingularInAbsenceOfHumanSingular() {
    AdderUsageObserver.setUsed(false);
    SourceTeeth source = new SourceTeeth();
    source.setTeeth(Arrays.asList("moler"));
    TargetDali target = SourceTargetMapper.INSTANCE.toTargetDali(source);
    assertThat(target).isNotNull();
    assertThat(target.getTeeth().size()).isEqualTo(1);
    assertThat(target.getTeeth().get(0)).isEqualTo(3);
    assertTrue(AdderUsageObserver.isUsed());
}
Also used : TargetDali(org.mapstruct.ap.test.collection.adder._target.TargetDali) SourceTeeth(org.mapstruct.ap.test.collection.adder.source.SourceTeeth) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 2 with SourceTeeth

use of org.mapstruct.ap.test.collection.adder.source.SourceTeeth in project mapstruct by mapstruct.

the class AdderTest method testshouldFallBackToDaliSingularInAbsenseOfHumanSingular.

@Test
public void testshouldFallBackToDaliSingularInAbsenseOfHumanSingular() {
    AdderUsageObserver.setUsed(false);
    SourceTeeth source = new SourceTeeth();
    source.setTeeth(Arrays.asList("moler"));
    TargetDali target = SourceTargetMapper.INSTANCE.toTargetDali(source);
    assertThat(target).isNotNull();
    assertThat(target.getTeeth().size()).isEqualTo(1);
    assertThat(target.getTeeth().get(0)).isEqualTo(3);
    assertTrue(AdderUsageObserver.isUsed());
}
Also used : TargetDali(org.mapstruct.ap.test.collection.adder._target.TargetDali) SourceTeeth(org.mapstruct.ap.test.collection.adder.source.SourceTeeth) Test(org.junit.Test)

Example 3 with SourceTeeth

use of org.mapstruct.ap.test.collection.adder.source.SourceTeeth in project mapstruct by mapstruct.

the class AdderTest method testShouldPreferHumanSingular.

@ProcessorTest
public void testShouldPreferHumanSingular() {
    AdderUsageObserver.setUsed(false);
    SourceTeeth source = new SourceTeeth();
    source.setTeeth(Arrays.asList("moler"));
    TargetHuman target = SourceTargetMapper.INSTANCE.toTargetHuman(source);
    assertThat(target).isNotNull();
    assertThat(target.getTeeth().size()).isEqualTo(1);
    assertThat(target.getTeeth().get(0)).isEqualTo(3);
    assertTrue(AdderUsageObserver.isUsed());
}
Also used : SourceTeeth(org.mapstruct.ap.test.collection.adder.source.SourceTeeth) TargetHuman(org.mapstruct.ap.test.collection.adder._target.TargetHuman) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

SourceTeeth (org.mapstruct.ap.test.collection.adder.source.SourceTeeth)3 TargetDali (org.mapstruct.ap.test.collection.adder._target.TargetDali)2 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)2 Test (org.junit.Test)1 TargetHuman (org.mapstruct.ap.test.collection.adder._target.TargetHuman)1