Skip to content

Conversation

@Avery-Dunn
Copy link
Contributor

@Avery-Dunn Avery-Dunn commented May 16, 2025

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:

  • Move tests into nested classes, to better organize similar test cases and allow them to be easily split off if they grow too large
  • Create helper methods for common configurations and behaviors
  • Move constants to their own file and follow standard naming

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

@Avery-Dunn Avery-Dunn requested a review from a team as a code owner May 16, 2025 00:40
@Avery-Dunn Avery-Dunn requested a review from Copilot May 16, 2025 00:43
Copy link
Contributor

Copilot AI left a 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.

@Avery-Dunn Avery-Dunn requested a review from Copilot May 20, 2025 20:16
Copy link
Contributor

Copilot AI left a 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

Avery-Dunn and others added 2 commits May 20, 2025 13:18
# Conflicts:
#	msal4j-sdk/src/test/java/com/microsoft/aad/msal4j/ManagedIdentityTests.java
@Avery-Dunn Avery-Dunn merged commit b02c8f2 into dev May 22, 2025
5 checks passed
@Avery-Dunn Avery-Dunn deleted the avdunn/refactor-msitests branch September 15, 2025 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants