Rewrite tests#5
Merged
Merged
Conversation
- TerminalUtilityTest has been renamed to TerminalServiceTest and individual test cases have been updated to test the current contract of TerminalService methods
- Add `mockito-junit-jupiter` dependency to `pom.xml` for injecting mocks Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com>
- Introduce `@Mock` for `TerminalService` and `DMI[Entity]Mapper` to mock dependencies. - Use `@InjectMocks` for `DMI[Entity]Service` to automatically inject mocked dependencies. - Remove static mocking of `TerminalUtility` and instead mock `TerminalService` and mappers, and refactor the tests to verify service contract, orders, instead of verifying the output of mapped data. Signed-off-by: Egg-03 <111327101+eggy03@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR contains a complete overhaul of the service and terminal tests
Type of Change
Tests
@MockforTerminalServiceandDMI[Entity]Mapperto mock dependencies.@InjectMocksforDMI[Entity]Serviceto automatically inject mocked dependencies.TerminalUtilityand instead mockTerminalServiceand mappers, and refactor the tests to verify service contract, orders, instead of verifying the output of mapped data.TerminalUtility(nowTerminalService) and the mapper would not be stubbed. With this overhaul, both mappers and terminal are stubbed and verification is performed based on what got executed instead, and not what was returned, since that is already tested in the mapping layer.