Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extensions are the Junit 5 way of extending its capabilities. MockitoExtension is setup strict by default which is very useful in that it shows us unnecessary stubs like org.mockito.exceptions.misusing.UnnecessaryStubbingException: Unnecessary stubbings detected. Clean & maintainable test code requires zero unnecessary code. Following stubbings are unnecessary (click to navigate to relevant line of code): 1. -> at org.openmrs.api.impl.PatientServiceImplTest.checkPatientIdentifiers_shouldThrowDuplicateIdentifierGivenDuplicateIdentifiers(PatientServiceImplTest.java:165) Please remove unnecessary stubbings or use 'lenient' strictness. More info: javadoc for UnnecessaryStubbingException class. this helps us clean up our tests that have had mocks added over time but not removed once not needed anymore. MockitoExtension also allows us to inject mocks in constructor/test methods Note that we did setup the mocked userContext.getAuthenticatedUser() in the ContextHelper as lenient so that this mock that all BaseContextSensitiveTest BaseContextMockTest BaseContextMockJunit5Test get does not cause such errors if not used
- Loading branch information
Showing
4 changed files
with
42 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters