Search in sources :

Example 1 with Case

use of org.mapstruct.ap.test.builder.multiple.builder.Case in project mapstruct by mapstruct.

the class MultipleBuilderMapperTest method tooManyBuilderCreationMethods.

@WithClasses({ TooManyBuilderCreationMethodsMapper.class })
@ExpectedCompilationOutcome(value = CompilationResult.SUCCEEDED, diagnostics = { @Diagnostic(type = Case.class, kind = javax.tools.Diagnostic.Kind.WARNING, line = 11, message = "More than one builder creation method for \"org.mapstruct.ap.test.builder.multiple.builder" + ".Case\". Found methods: \"wrongBuilder(), builder()\". Builder will not be used. Consider " + "implementing a custom BuilderProvider SPI.") })
@ProcessorTest
public void tooManyBuilderCreationMethods() {
    Case caseTarget = TooManyBuilderCreationMethodsMapper.INSTANCE.map(new Source("test"));
    assertThat(caseTarget).isNotNull();
    assertThat(caseTarget.getName()).isEqualTo("test");
    assertThat(caseTarget.getBuilderCreationMethod()).isNull();
    assertThat(caseTarget.getBuildMethod()).isEqualTo("constructor");
}
Also used : Case(org.mapstruct.ap.test.builder.multiple.builder.Case) ExpectedCompilationOutcome(org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome) ProcessorTest(org.mapstruct.ap.testutil.ProcessorTest) WithClasses(org.mapstruct.ap.testutil.WithClasses)

Aggregations

Case (org.mapstruct.ap.test.builder.multiple.builder.Case)1 ProcessorTest (org.mapstruct.ap.testutil.ProcessorTest)1 WithClasses (org.mapstruct.ap.testutil.WithClasses)1 ExpectedCompilationOutcome (org.mapstruct.ap.testutil.compilation.annotation.ExpectedCompilationOutcome)1