-
Notifications
You must be signed in to change notification settings - Fork 155
Refactor Managed Identity unit tests #957
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTestConstants.java
Outdated
Show resolved
Hide resolved
msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTestConstants.java
Show resolved
Hide resolved
…ityTestConstants.java Co-authored-by: Gladwin Johnson <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the ManagedIdentityTests class by organizing tests into nested classes, extracting helper methods, and moving constants to a dedicated file to improve readability and maintainability.
- Organized tests into nested classes for clarity
- Created helper methods for common configurations
- Moved constants to ManagedIdentityTestConstants for standardized naming
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTestDataProvider.java | Updated test data generation to use constants from ManagedIdentityTestConstants and adjusted method accessibility |
| msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTestConstants.java | Introduced a new constants file with standardized naming for test values and error responses |
msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTestConstants.java
Outdated
Show resolved
Hide resolved
…ityTestConstants.java Co-authored-by: Copilot <[email protected]>
# Conflicts: # msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTests.java
The ManagedIdentityTests class was made to test all managed identity behavior in one place, but as new sources were supported and new edge cases were tested the class ballooned in size.
This PR is a complete refactor of that test class, and does the following:
This refactor also tries to use the best practices and features of JUnit which were not available in the version the library was originally written. Ideally this will be an example that other test classes can follow to be more readable, maintainable, and expandable