Skip to content

Commit 2b39238

Browse files
committed
TG-23049 - added new attributes to @InTestsMock
1 parent 8b85218 commit 2b39238

File tree

1 file changed

+37
-13
lines changed

1 file changed

+37
-13
lines changed

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

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2024 Diffblue Limited.
2+
* Copyright 2024-2025 Diffblue Limited.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License").
55
* You may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
1818
import static java.lang.annotation.ElementType.METHOD;
1919
import static java.lang.annotation.ElementType.PACKAGE;
2020
import static java.lang.annotation.ElementType.TYPE;
21-
import static java.lang.annotation.RetentionPolicy.CLASS;
21+
import static java.lang.annotation.RetentionPolicy.RUNTIME;
2222

2323
import java.lang.annotation.Repeatable;
2424
import java.lang.annotation.Retention;
@@ -32,29 +32,53 @@
3232
*
3333
* @since Diffblue Cover 2024.04.02
3434
*/
35-
@Retention(CLASS)
35+
@Retention(RUNTIME)
3636
@Target({PACKAGE, TYPE, METHOD})
3737
@Repeatable(InTestsMock.Repeatable.class)
3838
public @interface InTestsMock {
3939

4040
/** Collects multiple {@link InTestsMock} annotations. */
41-
@Retention(CLASS)
41+
@Retention(RUNTIME)
4242
@Target({PACKAGE, TYPE, METHOD})
4343
@interface Repeatable {
4444

45-
/**
46-
* @return the repeated {@link InTestsMock} annotations.
47-
*/
45+
/** @return the repeated {@link InTestsMock} annotations. */
4846
InTestsMock[] value();
4947
}
5048

51-
/**
52-
* @return the classes to mock (or not).
53-
*/
49+
/** @return the classes to mock (or not). */
5450
Class<?>[] value();
5551

56-
/**
57-
* @return the mocking decision to apply.
58-
*/
52+
/** @return the mocking decision to apply. */
5953
MockDecision decision() default RECOMMENDED;
54+
55+
/** @return name of method to mock */
56+
String method() default "";
57+
58+
/** @return boolean value or values to return from the {@link #method()} */
59+
boolean[] booleanReturnValues() default {};
60+
61+
/** @return byte value or values to return from the {@link #method()} */
62+
byte[] byteReturnValues() default {};
63+
64+
/** @return char value or values to return from the {@link #method()} */
65+
char[] charReturnValues() default {};
66+
67+
/** @return float value or values to return from the {@link #method()} */
68+
float[] floatReturnValues() default {};
69+
70+
/** @return double value or values to return from the {@link #method()} */
71+
double[] doubleReturnValues() default {};
72+
73+
/** @return int value or values to return from the {@link #method()} */
74+
int[] intReturnValues() default {};
75+
76+
/** @return long value or values to return from the {@link #method()} */
77+
long[] longReturnValues() default {};
78+
79+
/** @return short value or values to return from the {@link #method()} */
80+
short[] shortReturnValues() default {};
81+
82+
/** @return String value or values to return from the {@link #method()} */
83+
String[] stringReturnValues() default {};
6084
}

0 commit comments

Comments
 (0)