Search in sources :

Example 1 with Foo

use of org.mapstruct.ap.test.imports.from.Foo in project mapstruct by mapstruct.

the class ConflictingTypesNamesTest method mapperImportingTypesWithConflictingNamesCanBeGenerated.

@ProcessorTest
public void mapperImportingTypesWithConflictingNamesCanBeGenerated() {
    Named source = new Named();
    source.setFoo(123);
    source.setBar(456L);
    ParseException target = SourceTargetMapper.INSTANCE.sourceToTarget(source);
    assertThat(target).isNotNull();
    Foo foo = new Foo();
    foo.setName("bar");
    org.mapstruct.ap.test.imports.to.Foo foo2 = SourceTargetMapper.INSTANCE.fooToFoo(foo);
    assertThat(foo2).isNotNull();
    assertThat(foo2.getName()).isEqualTo("bar");
}
Also used : Foo(org.mapstruct.ap.test.imports.from.Foo) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Example 2 with Foo

use of org.mapstruct.ap.test.imports.from.Foo 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");
}
Also used : Foo(org.mapstruct.ap.test.imports.from.Foo) FooWrapper(org.mapstruct.ap.test.imports.from.FooWrapper) IssueKey(org.mapstruct.ap.testutil.IssueKey) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest)

Aggregations

Foo (org.mapstruct.ap.test.imports.from.Foo)2 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)2 FooWrapper (org.mapstruct.ap.test.imports.from.FooWrapper)1 IssueKey (org.mapstruct.ap.testutil.IssueKey)1