use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class ConflictingTypesNamesTest method importsForTargetTypes.
@ProcessorTest
@IssueKey("156")
public void importsForTargetTypes() {
FooWrapper source = new FooWrapper();
Foo value = new Foo();
value.setName("foo");
source.setValue(value);
org.mapstruct.ap.test.imports.to.FooWrapper result = SecondSourceTargetMapper.INSTANCE.fooWrapperToFooWrapper(source);
assertThat(result).isNotNull();
assertThat(result.getValue()).isNotNull();
assertThat(result.getValue().getName()).isEqualTo("foo");
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class QualifierTest method shouldNotUseQualifierAnnotatedMethod.
@ProcessorTest
@WithClasses({ MapperWithoutQualifiedBy.class, Facts.class, EnglishToGerman.class, Reverse.class })
@IssueKey("341")
public void shouldNotUseQualifierAnnotatedMethod() {
OriginalRelease foreignMovies = new OriginalRelease();
foreignMovies.setTitle("Sixth Sense, The");
GermanRelease result = MapperWithoutQualifiedBy.INSTANCE.map(foreignMovies);
assertThat(result).isNotNull();
assertThat(result.getTitle()).isEqualTo("ehT ,esneS htxiS");
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class QualifierTest method testFactorySelectionWithQualifier.
@ProcessorTest
@WithClasses({ MovieFactoryMapper.class, ReleaseFactory.class, CreateGermanRelease.class })
@IssueKey("342")
public void testFactorySelectionWithQualifier() {
OriginalRelease foreignMovies = new OriginalRelease();
foreignMovies.setTitle("Sixth Sense, The");
foreignMovies.setKeyWords(Arrays.asList("evergreen", "magnificent"));
Map<String, List<String>> facts = new HashMap<>();
facts.put("director", Arrays.asList("M. Night Shyamalan"));
facts.put("cast", Arrays.asList("Bruce Willis", "Haley Joel Osment", "Toni Collette"));
facts.put("plot keywords", Arrays.asList("boy", "child psychologist", "I see dead people"));
foreignMovies.setFacts(facts);
AbstractEntry abstractEntry = MovieFactoryMapper.INSTANCE.toGerman(foreignMovies);
assertThat(abstractEntry).isNotNull();
assertThat(abstractEntry).isInstanceOf(GermanRelease.class);
assertThat(abstractEntry.getTitle()).isEqualTo("Sixth Sense, The");
assertThat(abstractEntry.getKeyWords()).isNotNull();
assertThat(abstractEntry.getKeyWords().size()).isEqualTo(2);
assertThat(abstractEntry.getKeyWords()).containsSequence("evergreen", "magnificent");
assertThat(abstractEntry.getFacts()).isNotNull();
assertThat(abstractEntry.getFacts()).hasSize(3);
assertThat(abstractEntry.getFacts()).contains(entry("director", Arrays.asList("M. Night Shyamalan")), entry("cast", Arrays.asList("Bruce Willis", "Haley Joel Osment", "Toni Collette")), entry("plot keywords", Arrays.asList("boy", "child psychologist", "I see dead people")));
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class JavaExpressionTest method testJavaExpressionInsertionWithSeveralSources.
@IssueKey("255")
@ProcessorTest
@WithClasses({ Source.class, Source2.class, Target.class, TimeAndFormat.class, SourceTargetMapperSeveralSources.class })
public void testJavaExpressionInsertionWithSeveralSources() throws ParseException {
Source source1 = new Source();
String format = "dd-MM-yyyy,hh:mm:ss";
Date time = getTime(format, "09-01-2014,01:35:03");
source1.setFormat(format);
source1.setTime(time);
Source2 source2 = new Source2();
source2.setAnotherProp("test");
Target target = SourceTargetMapperSeveralSources.INSTANCE.sourceToTarget(source1, source2);
assertThat(target).isNotNull();
assertThat(target.getTimeAndFormat().getTime()).isEqualTo(time);
assertThat(target.getTimeAndFormat().getFormat()).isEqualTo(format);
assertThat(target.getAnotherProp()).isEqualTo("test");
}
use of org.mapstruct.ap.testutil.IssueKey in project mapstruct by mapstruct.
the class AdderTest method testAdd.
@IssueKey("241")
@ProcessorTest
public void testAdd() throws DogException {
AdderUsageObserver.setUsed(false);
Source source = new Source();
source.setPets(Arrays.asList("mouse"));
Target target = SourceTargetMapper.INSTANCE.toTarget(source);
assertThat(target).isNotNull();
assertThat(target.getPets().size()).isEqualTo(1);
assertThat(target.getPets().get(0)).isEqualTo(2L);
assertTrue(AdderUsageObserver.isUsed());
}
Aggregations