diff --git a/.github/settings.xml b/.github/settings.xml
index 4c687a0..67f2297 100644
--- a/.github/settings.xml
+++ b/.github/settings.xml
@@ -8,9 +8,9 @@
${env.GPG_PASSPHRASE}
- ossrh
- ${env.MAVEN_USERNAME}
- ${env.MAVEN_PASSWORD}
+ central
+ ${env.MAVEN_USERNAME}
+ ${env.MAVEN_PASSWORD}
diff --git a/README.md b/README.md
index 570e232..87331f2 100644
--- a/README.md
+++ b/README.md
@@ -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")
}
```
diff --git a/pom.xml b/pom.xml
index 3a51e16..4752e23 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
4.0.0
com.diffblue.cover
cover-annotations
- 1.5.0
+ 1.6.0
jar
Cover Annotations
@@ -71,14 +71,13 @@
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.6.13
+ org.sonatype.central
+ central-publishing-maven-plugin
+ 0.7.0
true
- ossrh
- https://oss.sonatype.org/
- true
+ central
+ true
diff --git a/src/main/java/com/diffblue/cover/annotations/InTestsMock.java b/src/main/java/com/diffblue/cover/annotations/InTestsMock.java
index 5fc0fd6..eb944d5 100644
--- a/src/main/java/com/diffblue/cover/annotations/InTestsMock.java
+++ b/src/main/java/com/diffblue/cover/annotations/InTestsMock.java
@@ -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;
@@ -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 "";
}
diff --git a/src/main/java/com/diffblue/cover/annotations/exceptions/NoException.java b/src/main/java/com/diffblue/cover/annotations/exceptions/NoException.java
new file mode 100644
index 0000000..6249ef7
--- /dev/null
+++ b/src/main/java/com/diffblue/cover/annotations/exceptions/NoException.java
@@ -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.
+ }
+}