Skip to content

Commit 770e711

Browse files
committed
TG-23051 Specifying throwException and throwExceptionFactory for @InTestsMock when the mocked method is called
1 parent e5a4d35 commit 770e711

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/com/diffblue/cover/annotations/InTestsMock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
* @return exception type to throw when the mocked {@link #method()} is called. Defaults to {@link
9494
* NoException} to indicate no exception should be thrown.
9595
*/
96-
Class<?> throwException() default NoException.class;
96+
Class<? extends Throwable> throwException() default NoException.class;
9797

9898
/**
9999
* @return fully qualified name of the factory method used to create the exception to throw when

src/main/java/com/diffblue/cover/annotations/exceptions/NoException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* Marker class used to indicate that no exception should be thrown by default in {@link
1919
* com.diffblue.cover.annotations.InTestsMock#throwException()}.
2020
*/
21-
public final class NoException {
21+
public final class NoException extends Throwable {
2222
private NoException() {
2323
// This class should not be instantiated.
2424
}

0 commit comments

Comments
 (0)