use of org.mapstruct.ap.test.bugs._2195.dto.Source in project mapstruct by mapstruct.
the class AdderTest method testWildcardAdderTargetToSource.
@IssueKey("1170")
@ProcessorTest
public void testWildcardAdderTargetToSource() {
Target target = new Target();
target.addWithoutWildcard(2L);
target.addWildcardInTarget(2L);
target.getWildcardInSources().add(2L);
target.addWildcardInBoth(2L);
target.setWildcardAdderToSetters(Arrays.asList(2L));
Source source = AdderSourceTargetMapper.INSTANCE.toSource(target);
assertThat(source).isNotNull();
assertThat(source.getWithoutWildcards()).containsExactly("mouse");
((ListAssert<String>) assertThat(source.getWildcardInSources())).containsExactly("mouse");
assertThat(source.getWildcardInTargets()).containsExactly("mouse");
((ListAssert<String>) assertThat(source.getWildcardInBoths())).containsExactly("mouse");
((ListAssert<String>) assertThat(source.getWildcardAdderToSetters())).containsExactly("mouse");
}
use of org.mapstruct.ap.test.bugs._2195.dto.Source in project mapstruct by mapstruct.
the class AdderTest method testWildcardAdder.
@IssueKey("1170")
@ProcessorTest
public void testWildcardAdder() {
Source source = new Source();
source.addWithoutWildcard("mouse");
source.addWildcardInTarget("mouse");
source.addWildcardInSource("mouse");
source.addWildcardInBoth("mouse");
source.addWildcardAdderToSetter("mouse");
Target target = AdderSourceTargetMapper.INSTANCE.toTarget(source);
assertThat(target).isNotNull();
assertThat(target.getWithoutWildcards()).containsExactly(2L);
assertThat(target.getWildcardInSources()).containsExactly(2L);
((ListAssert<Long>) assertThat(target.getWildcardInTargets())).containsExactly(2L);
((ListAssert<Long>) assertThat(target.getWildcardInBoths())).containsExactly(2L);
assertThat(target.getWildcardAdderToSetters()).containsExactly(2L);
}
use of org.mapstruct.ap.test.bugs._2195.dto.Source in project mapstruct by mapstruct.
the class Issue1269Test method shouldMapNestedPropertiesCorrectly.
@ProcessorTest
public void shouldMapNestedPropertiesCorrectly() {
VehicleTypeInfo sourceTypeInfo = new VehicleTypeInfo("Opel", "Corsa", 3);
List<VehicleImage> sourceImages = Arrays.asList(new VehicleImage(100, "something"), new VehicleImage(150, "somethingElse"));
Vehicle source = new Vehicle(sourceTypeInfo, sourceImages);
VehicleDto target = VehicleMapper.INSTANCE.map(source);
assertThat(target.getVehicleInfo()).isNotNull();
assertThat(target.getVehicleInfo().getDoors()).isEqualTo(3);
assertThat(target.getVehicleInfo().getType()).isEqualTo("Opel");
assertThat(target.getVehicleInfo().getName()).isEqualTo("Corsa");
assertThat(target.getVehicleInfo().getImages()).hasSize(2);
assertThat(target.getVehicleInfo().getImages().get(0)).isEqualToComparingFieldByField(sourceImages.get(0));
assertThat(target.getVehicleInfo().getImages().get(1)).isEqualToComparingFieldByField(sourceImages.get(1));
}
use of org.mapstruct.ap.test.bugs._2195.dto.Source in project mapstruct by mapstruct.
the class Issue892Test method compiles.
@ProcessorTest
public void compiles() {
Source src = new Source();
src.setType(42);
Target target = Mappers.getMapper(Issue892Mapper.class).toTarget(src);
assertThat(target.getType()).isEqualTo(42);
}
use of org.mapstruct.ap.test.bugs._2195.dto.Source in project mapstruct by mapstruct.
the class Issue2195Test method test.
@ProcessorTest
@WithClasses(Issue2195Mapper.class)
public void test() {
Source source = new Source();
source.setName("JohnDoe");
TargetBase target = Issue2195Mapper.INSTANCE.map(source);
assertThat(target).isInstanceOf(Target.class);
}
Aggregations