Skip to content

Commit c4312da

Browse files
committed
Added more sectional structure to README.md
1 parent 1877aaf commit c4312da

File tree

1 file changed

+33
-8
lines changed

1 file changed

+33
-8
lines changed

README.md

Lines changed: 33 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,17 @@ dependencies {
3737
}
3838
```
3939

40-
## Annotations
41-
4240
Annotations placed on packages affect tests for all classes and methods under test in that package.
4341
Annotations placed on classes affect tests for that class and all it's methods under test, overriding package level annotations.
4442
Annotations placed on methods affect just that method under test, overriding package and class level annotations.
4543

46-
| Annotation | Equivalent `dcover create` option |
47-
|:---------------------------|:----------------------------------|
48-
| `@InTestsMock` | `--mock`, `--disable-mock-inputs` |
49-
| `@InTestsMockConstruction` | `--mock-construction` |
50-
| `@InTestsMockStatic` | `--mock-static` |
51-
5244
The annotations will be respected by Diffblue Cover via both command line and IntelliJ Plugin.
5345
When used from the command line in conjunction with equivalent options then the command line options take priority over the annotations found.
5446

47+
## Mocking Annotations
48+
49+
Mocking annotations allow fine grained control over what mocking should be preferred when testing.
50+
5551
### Using `@InTestsMock`
5652

5753
Perhaps you have a method that Diffblue Cover would ordinarily test using an `Integer` but you'd prefer to see it tested using `Mockito.mock(..)`.
@@ -77,6 +73,13 @@ public class ClassUnderTest {
7773
}
7874
```
7975

76+
> [!NOTE]
77+
> Using `@InTestsMock` has the same effect as, and can be overridden by, Cover CLI command line options:
78+
>
79+
> ```
80+
> dcover create --mock ClassToMock --disable-mock-inputs ClassToForbidMocking
81+
> ```
82+
8083
### Using `@InTestsMockConstruction`
8184
8285
Perhaps you have a method that Diffblue Cover is unable to test, and you think it could make more progress using `Mockito.mockConstruction(Random.class)`.
@@ -91,6 +94,13 @@ public class ClassUnderTest {
9194
}
9295
```
9396
97+
> [!NOTE]
98+
> Note that using `@InTestsMockConstruction` has the same effect as, and can be overridden by, Cover CLI command line option:
99+
>
100+
> ```
101+
> dcover create --mock-construction ClassToMockConstruction
102+
> ```
103+
94104
### Using `@InTestsMockStatic`
95105
96106
Perhaps you have a method that Diffblue Cover is unable to test, and you think it could make more progress using `Mockito.mockStatic(UUID.class)`.
@@ -105,6 +115,17 @@ public class ClassUnderTest {
105115
}
106116
```
107117
118+
> [!NOTE]
119+
> Using `@InTestsMockStatic` has the same effect as, and can be overridden by, Cover CLI command line option:
120+
>
121+
> ```
122+
> dcover create --mock-static ClassToMockStatic
123+
> ```
124+
125+
## Custom Input Annotations
126+
127+
Custom input annotations allow particular inputs to be recommended to Diffblue Cover when writing tests.
128+
108129
### Using `@InTestsUseEnum`
109130
110131
The `@InTestsUseEnum` annotation allows the user to recommend specific `enum` literal values to use in tests.
@@ -233,6 +254,10 @@ public static boolean isNearPi(@InTestsUseDoubles(Math.PI) float input) {
233254
}
234255
```
235256

257+
## Interesting Value Annotations
258+
259+
Interesting value annotations allow users to promote existing fields and methods to be identified and used in particular roles by Diffblue Cover when writing tests.
260+
236261
### Using `@InterestingTestFactory`
237262

238263
Indicates the annotated method as a useful factory method for use in tests.

0 commit comments

Comments
 (0)