Search in sources :

Example 1 with SingleElementSource

use of org.mapstruct.ap.test.collection.adder.source.SingleElementSource 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());
}
Also used : SingleElementSource(org.mapstruct.ap.test.collection.adder.source.SingleElementSource) Target(org.mapstruct.ap.test.collection.adder._target.Target) IssueKey(org.mapstruct.ap.testutil.IssueKey) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

Target (org.mapstruct.ap.test.collection.adder._target.Target)1 SingleElementSource (org.mapstruct.ap.test.collection.adder.source.SingleElementSource)1 IssueKey (org.mapstruct.ap.testutil.IssueKey)1 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)1