diff --git a/processor/src/test/java/org/mapstruct/ap/testutil/runner/AnnotationProcessorTestRunner.java b/processor/src/test/java/org/mapstruct/ap/testutil/runner/AnnotationProcessorTestRunner.java index 80d2c104b..8cfabf29d 100644 --- a/processor/src/test/java/org/mapstruct/ap/testutil/runner/AnnotationProcessorTestRunner.java +++ b/processor/src/test/java/org/mapstruct/ap/testutil/runner/AnnotationProcessorTestRunner.java @@ -60,7 +60,18 @@ public class AnnotationProcessorTestRunner extends ParentRunner { public AnnotationProcessorTestRunner(Class klass) throws Exception { super( klass ); - runners = Arrays. asList( + runners = createRunners( klass ); + } + + @SuppressWarnings("deprecation") + private List createRunners(Class klass) throws Exception { + WithSingleCompiler singleCompiler = klass.getAnnotation( WithSingleCompiler.class ); + + if (singleCompiler != null) { + return Arrays. asList( new InnerAnnotationProcessorRunner( klass, singleCompiler.value() ) ); + } + + return Arrays. asList( new InnerAnnotationProcessorRunner( klass, Compiler.JDK ), new InnerAnnotationProcessorRunner( klass, Compiler.ECLIPSE ) ); } diff --git a/processor/src/test/java/org/mapstruct/ap/testutil/runner/WithSingleCompiler.java b/processor/src/test/java/org/mapstruct/ap/testutil/runner/WithSingleCompiler.java new file mode 100644 index 000000000..9a2fc7018 --- /dev/null +++ b/processor/src/test/java/org/mapstruct/ap/testutil/runner/WithSingleCompiler.java @@ -0,0 +1,42 @@ +/** + * Copyright 2012-2016 Gunnar Morling (http://www.gunnarmorling.de/) + * and/or other contributors as indicated by the @authors tag. See the + * copyright.txt file in the distribution for a full listing of all + * contributors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.mapstruct.ap.testutil.runner; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Temporarily only use the specified compiler for the test during debugging / implementation. + *

+ * Do not commit tests with this annotation present! + * + * @deprecated Do not commit tests with this annotation present. Tests are expected to work with all compilers. + * @author Andreas Gudian + */ +@Deprecated +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface WithSingleCompiler { + /** + * @return The compiler to use. + */ + Compiler value(); +}