Skip to content

Commit 74be74a

Browse files
authored
Merge pull request #41 from diffblue/pcrane/feature/intestsusefactory-annotation
[TG-21232] Add `@InTestsUseFactory` annotation
2 parents 1cdf923 + 1969e1c commit 74be74a

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
java-version: '8'
2525

2626
- name: Run Spotless Check
27-
run: mvn spotless:check
27+
run: mvn --batch-mode spotless:check
2828

2929
- name: Compile Project
30-
run: mvn compile
30+
run: mvn --batch-mode compile

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ For installation into a Maven project the `provided` scope is recommended so tha
2424
<dependency>
2525
<groupId>com.diffblue.cover</groupId>
2626
<artifactId>cover-annotations</artifactId>
27-
<version>1.5.0</version>
27+
<version>1.7.0</version>
2828
<scope>provided</scope>
2929
</dependency>
3030
</dependencies>
@@ -36,9 +36,9 @@ For installation into a Gradle project the `compileOnly` and `testImplementation
3636

3737
```
3838
dependencies {
39-
compileOnly("com.diffblue.cover:cover-annotations:1.6.0")
39+
compileOnly("com.diffblue.cover:cover-annotations:1.7.0")
4040
41-
testImplementation("com.diffblue.cover:cover-annotations:1.6.0")
41+
testImplementation("com.diffblue.cover:cover-annotations:1.7.0")
4242
}
4343
```
4444

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<modelVersion>4.0.0</modelVersion>
1717
<groupId>com.diffblue.cover</groupId>
1818
<artifactId>cover-annotations</artifactId>
19-
<version>1.6.0</version>
19+
<version>1.7.0</version>
2020
<packaging>jar</packaging>
2121

2222
<name>Cover Annotations</name>
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* Copyright 2024-2025 Diffblue Limited.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
package com.diffblue.cover.annotations;
16+
17+
import static java.lang.annotation.ElementType.METHOD;
18+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
19+
20+
import java.lang.annotation.Repeatable;
21+
import java.lang.annotation.Retention;
22+
import java.lang.annotation.Target;
23+
24+
/**
25+
* Identifies factories that should be considered when writing tests for the annotated method.
26+
*
27+
* @since Diffblue Cover 2024.10.01
28+
*/
29+
@Retention(RUNTIME)
30+
@Target(METHOD)
31+
@Repeatable(InTestsUseFactories.Repeatable.class)
32+
public @interface InTestsUseFactories {
33+
34+
/** Collects multiple {@link InTestsUseFactories} annotations. */
35+
@Retention(RUNTIME)
36+
@Target(METHOD)
37+
@interface Repeatable {
38+
39+
/** @return the repeated {@link InTestsUseFactories} annotations. */
40+
InTestsUseFactories[] value();
41+
}
42+
43+
/** @return The name of the class containing the factory methods. */
44+
String className();
45+
46+
/** @return The method names to use for factory methods. */
47+
String[] methodNames();
48+
}

0 commit comments

Comments
 (0)