diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntry.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntry.java index 041da0c2e..dff1f649c 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntry.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntry.java @@ -18,16 +18,15 @@ */ package org.mapstruct.ap.test.nestedsourceproperties; -import org.mapstruct.ap.test.nestedsourceproperties.source.Song; -import org.mapstruct.ap.test.nestedsourceproperties.source.Chart; -import org.mapstruct.ap.test.nestedsourceproperties.target.ChartEntry; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; +import org.mapstruct.ap.test.nestedsourceproperties.source.Chart; +import org.mapstruct.ap.test.nestedsourceproperties.source.Song; +import org.mapstruct.ap.test.nestedsourceproperties.target.ChartEntry; import org.mapstruct.factory.Mappers; /** - * * @author Sjaak Derksen */ @Mapper @@ -35,34 +34,34 @@ public interface ArtistToChartEntry { ArtistToChartEntry MAPPER = Mappers.getMapper( ArtistToChartEntry.class ); - @Mappings( { - @Mapping( target = "chartName", source = "chart.name" ), - @Mapping( target = "title", source = "song.title" ), - @Mapping( target = "artistName", source = "song.artist.name" ), - @Mapping( target = "recordedAt", source = "song.artist.label.studio.name" ), - @Mapping( target = "city", source = "song.artist.label.studio.city" ), - @Mapping( target = "position", source = "position" ) - } ) - ChartEntry map( Chart chart, Song song, Integer position ); + @Mappings({ + @Mapping(target = "chartName", source = "chart.name"), + @Mapping(target = "title", source = "song.title"), + @Mapping(target = "artistName", source = "song.artist.name"), + @Mapping(target = "recordedAt", source = "song.artist.label.studio.name"), + @Mapping(target = "city", source = "song.artist.label.studio.city"), + @Mapping(target = "position", source = "position") + }) + ChartEntry map(Chart chart, Song song, Integer position); - @Mappings( { - @Mapping( target = "chartName", ignore = true ), - @Mapping( target = "title", source = "title" ), - @Mapping( target = "artistName", source = "artist.name" ), - @Mapping( target = "recordedAt", source = "artist.label.studio.name" ), - @Mapping( target = "city", source = "artist.label.studio.city" ), - @Mapping( target = "position", ignore = true ) - } ) - ChartEntry map( Song song ); + @Mappings({ + @Mapping(target = "chartName", ignore = true), + @Mapping(target = "title", source = "title"), + @Mapping(target = "artistName", source = "artist.name"), + @Mapping(target = "recordedAt", source = "artist.label.studio.name"), + @Mapping(target = "city", source = "artist.label.studio.city"), + @Mapping(target = "position", ignore = true) + }) + ChartEntry map(Song song); - @Mappings( { - @Mapping( target = "chartName", source = "name" ), - @Mapping( target = "title", ignore = true ), - @Mapping( target = "artistName", ignore = true ), - @Mapping( target = "recordedAt", ignore = true ), - @Mapping( target = "city", ignore = true ), - @Mapping( target = "position", ignore = true ) - } ) - ChartEntry map( Chart name ); + @Mappings({ + @Mapping(target = "chartName", source = "name"), + @Mapping(target = "title", ignore = true), + @Mapping(target = "artistName", ignore = true), + @Mapping(target = "recordedAt", ignore = true), + @Mapping(target = "city", ignore = true), + @Mapping(target = "position", ignore = true) + }) + ChartEntry map(Chart name); } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryAdder.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryAdder.java index 297d5a0e8..3e940eba5 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryAdder.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryAdder.java @@ -19,23 +19,23 @@ package org.mapstruct.ap.test.nestedsourceproperties; import org.mapstruct.CollectionMappingStrategy; -import org.mapstruct.ap.test.nestedsourceproperties.source.Chart; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; +import org.mapstruct.ap.test.nestedsourceproperties.source.Chart; import org.mapstruct.ap.test.nestedsourceproperties.target.ChartPositions; import org.mapstruct.factory.Mappers; /** - * * @author Sjaak Derksen */ -@Mapper( collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED ) +@Mapper(collectionMappingStrategy = CollectionMappingStrategy.ADDER_PREFERRED) public interface ArtistToChartEntryAdder { ArtistToChartEntryAdder MAPPER = Mappers.getMapper( ArtistToChartEntryAdder.class ); - @Mappings( { - @Mapping( target = "positions", source = "chart.song.positions" ), } ) - ChartPositions map( Chart chart ); + @Mappings({ + @Mapping(target = "positions", source = "chart.song.positions"), + }) + ChartPositions map(Chart chart); } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryGetter.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryGetter.java index 54bafd4f2..1e4c585b7 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryGetter.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/ArtistToChartEntryGetter.java @@ -18,15 +18,14 @@ */ package org.mapstruct.ap.test.nestedsourceproperties; -import org.mapstruct.ap.test.nestedsourceproperties.source.Chart; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Mappings; +import org.mapstruct.ap.test.nestedsourceproperties.source.Chart; import org.mapstruct.ap.test.nestedsourceproperties.target.ChartPositions; import org.mapstruct.factory.Mappers; /** - * * @author Sjaak Derksen */ @Mapper @@ -34,7 +33,8 @@ public interface ArtistToChartEntryGetter { ArtistToChartEntryGetter MAPPER = Mappers.getMapper( ArtistToChartEntryGetter.class ); - @Mappings( { - @Mapping( target = "positions", source = "chart.song.positions" ), } ) - ChartPositions map( Chart chart ); + @Mappings({ + @Mapping(target = "positions", source = "chart.song.positions"), + }) + ChartPositions map(Chart chart); } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/NestedSourcePropertiesTest.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/NestedSourcePropertiesTest.java index 510b30b05..ff9be4f15 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/NestedSourcePropertiesTest.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/NestedSourcePropertiesTest.java @@ -18,10 +18,6 @@ */ package org.mapstruct.ap.test.nestedsourceproperties; -import static org.fest.assertions.Assertions.assertThat; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import java.util.Arrays; import org.junit.Test; @@ -38,17 +34,20 @@ import org.mapstruct.ap.testutil.IssueKey; import org.mapstruct.ap.testutil.WithClasses; import org.mapstruct.ap.testutil.runner.AnnotationProcessorTestRunner; +import static org.fest.assertions.Assertions.assertThat; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + /** - * * @author Sjaak Derksen */ -@WithClasses( { Song.class, Artist.class, Chart.class, Label.class, Studio.class, ChartEntry.class } ) -@IssueKey( "65" ) -@RunWith( AnnotationProcessorTestRunner.class ) +@WithClasses({ Song.class, Artist.class, Chart.class, Label.class, Studio.class, ChartEntry.class }) +@IssueKey("65") +@RunWith(AnnotationProcessorTestRunner.class) public class NestedSourcePropertiesTest { - @Test - @WithClasses( { ArtistToChartEntry.class } ) + @Test + @WithClasses({ ArtistToChartEntry.class }) public void shouldGenerateImplementationForPropertyNamesOnly() { Studio studio = new Studio(); @@ -79,7 +78,7 @@ public class NestedSourcePropertiesTest { } @Test - @WithClasses( { ArtistToChartEntry.class } ) + @WithClasses({ ArtistToChartEntry.class }) public void shouldGenerateImplementationForMultipleParam() { Studio studio = new Studio(); @@ -114,7 +113,7 @@ public class NestedSourcePropertiesTest { } @Test - @WithClasses( { ArtistToChartEntry.class } ) + @WithClasses({ ArtistToChartEntry.class }) public void shouldPickPropertyNameOverParameterName() { Chart chart = new Chart(); @@ -133,12 +132,12 @@ public class NestedSourcePropertiesTest { } @Test - @WithClasses( { ArtistToChartEntryAdder.class, ChartPositions.class, AdderUsageObserver.class } ) + @WithClasses({ ArtistToChartEntryAdder.class, ChartPositions.class, AdderUsageObserver.class }) public void shouldUseAddAsTargetAccessor() { AdderUsageObserver.setUsed( false ); Song song = new Song(); - song.setPositions( Arrays.asList( 3, 5) ); + song.setPositions( Arrays.asList( 3, 5 ) ); Chart chart = new Chart(); chart.setSong( song ); @@ -151,12 +150,12 @@ public class NestedSourcePropertiesTest { } @Test - @WithClasses( { ArtistToChartEntryGetter.class, ChartPositions.class, AdderUsageObserver.class } ) + @WithClasses({ ArtistToChartEntryGetter.class, ChartPositions.class, AdderUsageObserver.class }) public void shouldUseGetAsTargetAccessor() { AdderUsageObserver.setUsed( false ); Song song = new Song(); - song.setPositions( Arrays.asList( 3, 5) ); + song.setPositions( Arrays.asList( 3, 5 ) ); Chart chart = new Chart(); chart.setSong( song ); diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Artist.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Artist.java index b127915f9..5574f4a83 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Artist.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Artist.java @@ -19,7 +19,6 @@ package org.mapstruct.ap.test.nestedsourceproperties.source; /** - * * @author Sjaak Derksen */ public class Artist { @@ -32,7 +31,7 @@ public class Artist { return name; } - public void setName( String name ) { + public void setName(String name) { this.name = name; } @@ -40,7 +39,7 @@ public class Artist { return label; } - public void setLabel( Label label ) { + public void setLabel(Label label) { this.label = label; } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Chart.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Chart.java index 794b55eed..7e1cb63c9 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Chart.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Chart.java @@ -19,7 +19,6 @@ package org.mapstruct.ap.test.nestedsourceproperties.source; /** - * * @author Sjaak Derksen */ public class Chart { @@ -32,7 +31,7 @@ public class Chart { return type; } - public void setType( String type ) { + public void setType(String type) { this.type = type; } @@ -40,7 +39,7 @@ public class Chart { return name; } - public void setName( String name ) { + public void setName(String name) { this.name = name; } @@ -48,7 +47,7 @@ public class Chart { return song; } - public void setSong( Song song ) { + public void setSong(Song song) { this.song = song; } } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Label.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Label.java index a8254433e..2b6a14265 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Label.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Label.java @@ -19,7 +19,6 @@ package org.mapstruct.ap.test.nestedsourceproperties.source; /** - * * @author Sjaak Derksen */ public class Label { @@ -31,7 +30,7 @@ public class Label { return name; } - public void setName( String name ) { + public void setName(String name) { this.name = name; } @@ -39,7 +38,7 @@ public class Label { return studio; } - public void setStudio( Studio studio ) { + public void setStudio(Studio studio) { this.studio = studio; } } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Song.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Song.java index 92fe259d0..8c3c2b52f 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Song.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Song.java @@ -22,7 +22,6 @@ import java.util.List; /** - * * @author Sjaak Derksen */ public class Song { @@ -35,7 +34,7 @@ public class Song { return artist; } - public void setArtist( Artist artist ) { + public void setArtist(Artist artist) { this.artist = artist; } @@ -43,7 +42,7 @@ public class Song { return title; } - public void setTitle( String title ) { + public void setTitle(String title) { this.title = title; } @@ -51,7 +50,7 @@ public class Song { return positions; } - public void setPositions( List positions ) { + public void setPositions(List positions) { this.positions = positions; } } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Studio.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Studio.java index 44d8e8e46..a8db20ce5 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Studio.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/source/Studio.java @@ -19,7 +19,6 @@ package org.mapstruct.ap.test.nestedsourceproperties.source; /** - * * @author Sjaak Derksen */ public class Studio { @@ -31,7 +30,7 @@ public class Studio { return city; } - public void setCity( String city ) { + public void setCity(String city) { this.city = city; } @@ -39,7 +38,7 @@ public class Studio { return name; } - public void setName( String name ) { + public void setName(String name) { this.name = name; } } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartEntry.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartEntry.java index 95e3f560d..5477742fa 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartEntry.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartEntry.java @@ -19,7 +19,6 @@ package org.mapstruct.ap.test.nestedsourceproperties.target; /** - * * @author Sjaak Derksen */ public class ChartEntry { @@ -35,7 +34,7 @@ public class ChartEntry { return chartName; } - public void setChartName( String chartName ) { + public void setChartName(String chartName) { this.chartName = chartName; } @@ -43,7 +42,7 @@ public class ChartEntry { return title; } - public void setTitle( String title ) { + public void setTitle(String title) { this.title = title; } @@ -51,7 +50,7 @@ public class ChartEntry { return artistName; } - public void setArtistName( String artistName ) { + public void setArtistName(String artistName) { this.artistName = artistName; } @@ -59,7 +58,7 @@ public class ChartEntry { return recordedAt; } - public void setRecordedAt( String recordedAt ) { + public void setRecordedAt(String recordedAt) { this.recordedAt = recordedAt; } @@ -67,7 +66,7 @@ public class ChartEntry { return city; } - public void setCity( String city ) { + public void setCity(String city) { this.city = city; } @@ -75,7 +74,7 @@ public class ChartEntry { return position; } - public void setPosition( int position ) { + public void setPosition(int position) { this.position = position; } } diff --git a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartPositions.java b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartPositions.java index a07a82a28..dd2d200ad 100644 --- a/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartPositions.java +++ b/processor/src/test/java/org/mapstruct/ap/test/nestedsourceproperties/target/ChartPositions.java @@ -19,7 +19,6 @@ import java.util.ArrayList; import java.util.List; /** - * * @author Sjaak Derksen */ public class ChartPositions { @@ -30,7 +29,7 @@ public class ChartPositions { return positions; } - public Long addPosition( Long position ) { + public Long addPosition(Long position) { AdderUsageObserver.setUsed( true ); positions.add( position ); return position;