use of org.mapstruct.ap.test.nestedsourceproperties._target.ChartPositions in project mapstruct by mapstruct.
the class NestedSourcePropertiesTest method shouldUseAddAsTargetAccessor.
@ProcessorTest
@WithClasses({ ArtistToChartEntryAdder.class, ChartPositions.class, AdderUsageObserver.class })
public void shouldUseAddAsTargetAccessor() {
AdderUsageObserver.setUsed(false);
Song song = new Song();
song.setPositions(Arrays.asList(3, 5));
Chart chart = new Chart();
chart.setSong(song);
ChartPositions positions = ArtistToChartEntryAdder.MAPPER.map(chart);
assertThat(positions).isNotNull();
assertThat(positions.getPositions()).containsExactly(3L, 5L);
assertThat(AdderUsageObserver.isUsed()).isTrue();
}
use of org.mapstruct.ap.test.nestedsourceproperties._target.ChartPositions 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();
}
Aggregations