Skip to content

Release 1.5.0 #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ For installation into a Maven project the `provided` scope is recommended so tha
<dependency>
<groupId>com.diffblue.cover</groupId>
<artifactId>cover-annotations</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand All @@ -36,9 +36,9 @@ For installation into a Gradle project the `compileOnly` and `testImplementation

```
dependencies {
compileOnly("com.diffblue.cover:cover-annotations:1.4.0")
compileOnly("com.diffblue.cover:cover-annotations:1.5.0")

testImplementation("com.diffblue.cover:cover-annotations:1.4.0")
testImplementation("com.diffblue.cover:cover-annotations:1.5.0")
}
```

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.diffblue.cover</groupId>
<artifactId>cover-annotations</artifactId>
<version>1.4.0</version>
<version>1.5.0</version>
<packaging>jar</packaging>

<name>Cover Annotations</name>
Expand Down
50 changes: 37 additions & 13 deletions src/main/java/com/diffblue/cover/annotations/InTestsMock.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 Diffblue Limited.
* 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.
Expand All @@ -18,7 +18,7 @@
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.PACKAGE;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.CLASS;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
Expand All @@ -32,29 +32,53 @@
*
* @since Diffblue Cover 2024.04.02
*/
@Retention(CLASS)
@Retention(RUNTIME)
@Target({PACKAGE, TYPE, METHOD})
@Repeatable(InTestsMock.Repeatable.class)
public @interface InTestsMock {

/** Collects multiple {@link InTestsMock} annotations. */
@Retention(CLASS)
@Retention(RUNTIME)
@Target({PACKAGE, TYPE, METHOD})
@interface Repeatable {

/**
* @return the repeated {@link InTestsMock} annotations.
*/
/** @return the repeated {@link InTestsMock} annotations. */
InTestsMock[] value();
}

/**
* @return the classes to mock (or not).
*/
/** @return the classes to mock (or not). */
Class<?>[] value();

/**
* @return the mocking decision to apply.
*/
/** @return the mocking decision to apply. */
MockDecision decision() default RECOMMENDED;

/** @return name of method to mock */
String method() default "";

/** @return boolean value or values to return from the {@link #method()} */
boolean[] booleanReturnValues() default {};

/** @return byte value or values to return from the {@link #method()} */
byte[] byteReturnValues() default {};

/** @return char value or values to return from the {@link #method()} */
char[] charReturnValues() default {};

/** @return float value or values to return from the {@link #method()} */
float[] floatReturnValues() default {};

/** @return double value or values to return from the {@link #method()} */
double[] doubleReturnValues() default {};

/** @return int value or values to return from the {@link #method()} */
int[] intReturnValues() default {};

/** @return long value or values to return from the {@link #method()} */
long[] longReturnValues() default {};

/** @return short value or values to return from the {@link #method()} */
short[] shortReturnValues() default {};

/** @return String value or values to return from the {@link #method()} */
String[] stringReturnValues() default {};
}