Search in sources :

Example 21 with Song

use of org.mapstruct.ap.test.nestedsourceproperties.source.Song in project mapstruct by mapstruct.

the class NestedSourcePropertiesTest method shouldUseGetAsTargetAccessor.

@ProcessorTest
@WithClasses({ ArtistToChartEntryGetter.class, ChartPositions.class, AdderUsageObserver.class })
public void shouldUseGetAsTargetAccessor() {
    AdderUsageObserver.setUsed(false);
    Song song = new Song();
    song.setPositions(Arrays.asList(3, 5));
    Chart chart = new Chart();
    chart.setSong(song);
    ChartPositions positions = ArtistToChartEntryGetter.MAPPER.map(chart);
    assertThat(positions).isNotNull();
    assertThat(positions.getPositions()).containsExactly(3L, 5L);
    assertThat(AdderUsageObserver.isUsed()).isFalse();
}
Also used : Song(org.mapstruct.ap.test.nestedsourceproperties.source.Song) ChartPositions(org.mapstruct.ap.test.nestedsourceproperties._target.ChartPositions) Chart(org.mapstruct.ap.test.nestedsourceproperties.source.Chart) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest) WithClasses(org.mapstruct.ap.testutil.WithClasses)

Aggregations

Song (org.mapstruct.ap.test.nestedsourceproperties.source.Song)21 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)12 WithClasses (org.mapstruct.ap.testutil.WithClasses)11 ChartEntry (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntry)8 Artist (org.mapstruct.ap.test.nestedsourceproperties.source.Artist)6 Chart (org.mapstruct.ap.test.nestedsourceproperties.source.Chart)6 Label (org.mapstruct.ap.test.nestedsourceproperties.source.Label)5 Studio (org.mapstruct.ap.test.nestedsourceproperties.source.Studio)5 BaseChartEntry (org.mapstruct.ap.test.nestedsourceproperties._target.BaseChartEntry)4 ChartPositions (org.mapstruct.ap.test.nestedsourceproperties._target.ChartPositions)2 Test (org.junit.Test)1 ChartEntryComposed (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryComposed)1 ChartEntryLabel (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryLabel)1 ChartEntryWithBase (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryWithBase)1 ChartEntryWithMapping (org.mapstruct.ap.test.nestedsourceproperties._target.ChartEntryWithMapping)1