Skip to content

Release 1.6.0. #38

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 9 commits into from
Jun 6, 2025
Merged
6 changes: 3 additions & 3 deletions .github/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
</server>
<server>
<id>ossrh</id>
<username>${env.MAVEN_USERNAME}</username>
<password>${env.MAVEN_PASSWORD}</password>
<id>central</id>
<username>${env.MAVEN_USERNAME}</username>
<password>${env.MAVEN_PASSWORD}</password>
</server>
</servers>
<profiles>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ For installation into a Gradle project the `compileOnly` and `testImplementation

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

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

Expand Down
13 changes: 6 additions & 7 deletions 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.5.0</version>
<version>1.6.0</version>
<packaging>jar</packaging>

<name>Cover Annotations</name>
Expand Down Expand Up @@ -71,14 +71,13 @@
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/com/diffblue/cover/annotations/InTestsMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;

import com.diffblue.cover.annotations.exceptions.NoException;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
Expand Down Expand Up @@ -81,4 +82,22 @@

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

/**
* @return name of the factory method used to create the object returned by the mocked {@link
* #method()}
*/
String returnValueFactory() default "";

/**
* @return exception type to throw when the mocked {@link #method()} is called. Defaults to {@link
* NoException} to indicate no exception should be thrown.
*/
Class<? extends Throwable> throwException() default NoException.class;

/**
* @return fully qualified name of the factory method used to create the exception to throw when
* the mocked {@link #method()} is called.
*/
String throwExceptionFactory() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 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.exceptions;

/**
* Marker class used to indicate that no exception should be thrown by default in {@link
* com.diffblue.cover.annotations.InTestsMock#throwException()}.
*/
public final class NoException extends Throwable {
private NoException() {
// This class should not be instantiated.
}
}