diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fc1c742..e560962 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: java-version: '8' - name: Run Spotless Check - run: mvn spotless:check + run: mvn --batch-mode spotless:check - name: Compile Project - run: mvn compile + run: mvn --batch-mode compile diff --git a/README.md b/README.md index 87331f2..012a678 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ For installation into a Maven project the `provided` scope is recommended so tha com.diffblue.cover cover-annotations - 1.5.0 + 1.7.0 provided @@ -36,9 +36,9 @@ For installation into a Gradle project the `compileOnly` and `testImplementation ``` dependencies { - compileOnly("com.diffblue.cover:cover-annotations:1.6.0") + compileOnly("com.diffblue.cover:cover-annotations:1.7.0") - testImplementation("com.diffblue.cover:cover-annotations:1.6.0") + testImplementation("com.diffblue.cover:cover-annotations:1.7.0") } ``` diff --git a/pom.xml b/pom.xml index 1808962..0347d9e 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ 4.0.0 com.diffblue.cover cover-annotations - 1.6.0 + 1.7.0 jar Cover Annotations diff --git a/src/main/java/com/diffblue/cover/annotations/InTestsUseFactories.java b/src/main/java/com/diffblue/cover/annotations/InTestsUseFactories.java new file mode 100644 index 0000000..03d6903 --- /dev/null +++ b/src/main/java/com/diffblue/cover/annotations/InTestsUseFactories.java @@ -0,0 +1,48 @@ +/* + * Copyright 2024-2025 Diffblue Limited. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * or in the "license" file accompanying this file. This file 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 com.diffblue.cover.annotations; + +import static java.lang.annotation.ElementType.METHOD; +import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Repeatable; +import java.lang.annotation.Retention; +import java.lang.annotation.Target; + +/** + * Identifies factories that should be considered when writing tests for the annotated method. + * + * @since Diffblue Cover 2024.10.01 + */ +@Retention(RUNTIME) +@Target(METHOD) +@Repeatable(InTestsUseFactories.Repeatable.class) +public @interface InTestsUseFactories { + + /** Collects multiple {@link InTestsUseFactories} annotations. */ + @Retention(RUNTIME) + @Target(METHOD) + @interface Repeatable { + + /** @return the repeated {@link InTestsUseFactories} annotations. */ + InTestsUseFactories[] value(); + } + + /** @return The name of the class containing the factory methods. */ + String className(); + + /** @return The method names to use for factory methods. */ + String[] methodNames(); +}