Skip to content

Commit

Permalink
Merge pull request #2140 from slawekjaranowski/testng
Browse files Browse the repository at this point in the history
Endorsed MockitoTestNGListener in the documentation
  • Loading branch information
mockitoguy committed Jan 6, 2021
2 parents 975e4af + dddcc0a commit 9208854
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/main/java/org/mockito/Mockito.java
Expand Up @@ -1371,9 +1371,11 @@
*
* To quickly find out how "stricter" Mockito can make you more productive and get your tests cleaner, see:
* <ul>
* <li>Strict stubbing with JUnit Rules - {@link MockitoRule#strictness(Strictness)} with {@link Strictness#STRICT_STUBS}</li>
* <li>Strict stubbing with JUnit Runner - {@link MockitoJUnitRunner.StrictStubs}</li>
* <li>Strict stubbing if you cannot use runner/rule (like TestNG) - {@link MockitoSession}</li>
* <li>Strict stubbing with JUnit4 Rules - {@link MockitoRule#strictness(Strictness)} with {@link Strictness#STRICT_STUBS}</li>
* <li>Strict stubbing with JUnit4 Runner - {@link MockitoJUnitRunner.Strict}</li>
* <li>Strict stubbing with JUnit5 Extension - <code>org.mockito.junit.jupiter.MockitoExtension</code></li>
* <li>Strict stubbing with TestNG Listener <a href="https://github.com/mockito/mockito-testng">MockitoTestNGListener</a></li>
* <li>Strict stubbing if you cannot use runner/rule - {@link MockitoSession}</li>
* <li>Unnecessary stubbing detection with {@link MockitoJUnitRunner}</li>
* <li>Stubbing argument mismatch warnings, documented in {@link MockitoHint}</li>
* </ul>
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/mockito/MockitoSession.java
Expand Up @@ -27,7 +27,6 @@
* otherwise {@link UnfinishedMockingSessionException} is triggered when the next session is created.
* <p>
* {@code MockitoSession} is useful when you cannot use {@link MockitoJUnitRunner} or {@link MockitoRule}.
* For example, you work with TestNG instead of JUnit.
* Another example is when different JUnit runner is in use (Jukito, Springockito)
* and it cannot be combined with Mockito's own runner.
* <p>
Expand Down Expand Up @@ -74,7 +73,7 @@
* If you are JUnit user who does not leverage Mockito rule or runner we strongly recommend to do so.
* Both the runner and the rule support strict stubbing which can really help driving cleaner tests.
* See {@link MockitoJUnitRunner.StrictStubs} and {@link MockitoRule#strictness(Strictness)}.
* If you cannot use Mockito's JUnit support (for example, you are on TestNG) {@code MockitoSession} exactly is for you!
* If you cannot use Mockito's JUnit support {@code MockitoSession} exactly is for you!
* You can automatically take advantage of strict stubbing ({@link Strictness}),
* automatic initialization of annotated mocks ({@link MockitoAnnotations}),
* and extra validation ({@link Mockito#validateMockitoUsage()}).
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mockito/junit/MockitoJUnitRunner.java
Expand Up @@ -69,7 +69,7 @@
* </code></pre>
*
* If you would like to take advantage of Mockito JUnit runner features
* but you cannot use the runner because, for example, you use TestNG, there is a solution!
* but you cannot use the runner there is a solution!
* {@link MockitoSession} API is intended to offer cleaner tests and improved debuggability
* to users that cannot use Mockito's built-in JUnit support (runner or the rule).
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/mockito/junit/MockitoRule.java
Expand Up @@ -67,7 +67,7 @@
* </code></pre>
*
* If you would like to take advantage of Mockito JUnit rule features
* but you cannot use the rule because, for example, you use TestNG, there is a solution!
* but you cannot use the rule there is a solution!
* {@link MockitoSession} API is intended to offer cleaner tests and improved debuggability
* to users that cannot use Mockito's built-in JUnit support (runner or the rule).
*
Expand Down

0 comments on commit 9208854

Please sign in to comment.