|
1 | 1 | /*
|
2 |
| - * Copyright 2024 Diffblue Limited. |
| 2 | + * Copyright 2024-2025 Diffblue Limited. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License").
|
5 | 5 | * You may not use this file except in compliance with the License.
|
|
18 | 18 | import static java.lang.annotation.ElementType.METHOD;
|
19 | 19 | import static java.lang.annotation.ElementType.PACKAGE;
|
20 | 20 | import static java.lang.annotation.ElementType.TYPE;
|
21 |
| -import static java.lang.annotation.RetentionPolicy.CLASS; |
| 21 | +import static java.lang.annotation.RetentionPolicy.RUNTIME; |
22 | 22 |
|
23 | 23 | import java.lang.annotation.Repeatable;
|
24 | 24 | import java.lang.annotation.Retention;
|
|
32 | 32 | *
|
33 | 33 | * @since Diffblue Cover 2024.04.02
|
34 | 34 | */
|
35 |
| -@Retention(CLASS) |
| 35 | +@Retention(RUNTIME) |
36 | 36 | @Target({PACKAGE, TYPE, METHOD})
|
37 | 37 | @Repeatable(InTestsMock.Repeatable.class)
|
38 | 38 | public @interface InTestsMock {
|
39 | 39 |
|
40 | 40 | /** Collects multiple {@link InTestsMock} annotations. */
|
41 |
| - @Retention(CLASS) |
| 41 | + @Retention(RUNTIME) |
42 | 42 | @Target({PACKAGE, TYPE, METHOD})
|
43 | 43 | @interface Repeatable {
|
44 | 44 |
|
45 |
| - /** |
46 |
| - * @return the repeated {@link InTestsMock} annotations. |
47 |
| - */ |
| 45 | + /** @return the repeated {@link InTestsMock} annotations. */ |
48 | 46 | InTestsMock[] value();
|
49 | 47 | }
|
50 | 48 |
|
51 |
| - /** |
52 |
| - * @return the classes to mock (or not). |
53 |
| - */ |
| 49 | + /** @return the classes to mock (or not). */ |
54 | 50 | Class<?>[] value();
|
55 | 51 |
|
56 |
| - /** |
57 |
| - * @return the mocking decision to apply. |
58 |
| - */ |
| 52 | + /** @return the mocking decision to apply. */ |
59 | 53 | 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 {}; |
60 | 84 | }
|
0 commit comments