Assignment 1, Unit Testing - Chen Kang #4454
Closed
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.
Addressed Issue (1 mark):
Previously, the authentication module had poor test coverage. To address this, unit tests were written to thoroughly test the authentication module of the project. Given its critical role, achieving near 100% test coverage for the authentication module was essential.
What You Have Reengineered (1.5 marks):
Unit tests were implemented for three classes: JaasAuthenticationProvider, ManagedUserLoginConfiguration, and ManagedUserLoginModule. These tests were created using JUnit 5, a widely used testing framework, and Mockito, a popular library for mocking dependencies and simulating runtime behavior. The test cases cover the full lifecycle of the login modules, including edge cases and exceptional scenarios, ensuring robust validation
Impact of Changes (1 mark):
The implemented changes significantly improved the test coverage of the login and authentication modules. By automating tests with the JUnit library, development cycle time has been reduced. These tests act as a safety net, preventing erroneous code from being deployed to production. Errors can now be detected and resolved early during the testing phase, minimizing the risk of system failures or bugs in the production environment. This ensures the stability and reliability of the authentication system throughout development and deployment.