use of org.mapstruct.ap.test.collection.adder._target.Target 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());
}
use of org.mapstruct.ap.test.collection.adder._target.Target in project mapstruct by mapstruct.
the class AdderTest method testSingleElementSource.
@IssueKey("242")
@ProcessorTest
public void testSingleElementSource() {
AdderUsageObserver.setUsed(false);
SingleElementSource source = new SingleElementSource();
source.setPet("mouse");
Target target = SourceTargetMapper.INSTANCE.fromSingleElementSource(source);
assertThat(target).isNotNull();
assertThat(target.getPets().size()).isEqualTo(1);
assertThat(target.getPets().get(0)).isEqualTo(2L);
assertTrue(AdderUsageObserver.isUsed());
}
use of org.mapstruct.ap.test.collection.adder._target.Target 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());
}
use of org.mapstruct.ap.test.collection.adder._target.Target in project mapstruct by mapstruct.
the class AdderTest method testAddViaTargetType.
@ProcessorTest
public void testAddViaTargetType() {
AdderUsageObserver.setUsed(false);
Source source = new Source();
source.setPets(Arrays.asList("mouse"));
TargetViaTargetType target = SourceTargetMapper.INSTANCE.toTargetViaTargetType(source);
assertThat(target).isNotNull();
assertThat(target.getPets().size()).isEqualTo(1);
assertThat(target.getPets().get(0)).isNotNull();
assertThat(target.getPets().get(0).getValue()).isEqualTo(2L);
assertTrue(AdderUsageObserver.isUsed());
}
use of org.mapstruct.ap.test.collection.adder._target.Target in project mapstruct by mapstruct.
the class AdderTest method testAdd.
@IssueKey("241")
@ProcessorTest
public void testAdd() throws DogException {
AdderUsageObserver.setUsed(false);
Source source = new Source();
source.setPets(Arrays.asList("mouse"));
Target target = SourceTargetMapper.INSTANCE.toTarget(source);
assertThat(target).isNotNull();
assertThat(target.getPets().size()).isEqualTo(1);
assertThat(target.getPets().get(0)).isEqualTo(2L);
assertTrue(AdderUsageObserver.isUsed());
}
Aggregations