2020 * Tests for FMI (Federated Managed Identity) support in client credential flows.
2121 * Covers fmi_path body parameter injection, cache key isolation via ext_cache_key,
2222 * and assertion context (AssertionRequestOptions) propagation.
23- *
24- * These tests correspond to MSAL .NET's FmiIntegrationTests (§1-§3) and
25- * UserFederatedIdentityCredentialTests (§4-§5) in the AgentIDs_ComponentsReference.
2623 */
2724@ TestInstance (TestInstance .Lifecycle .PER_CLASS )
2825class FmiTest {
2926
3027 // ========================================================================
31- // §2: fmi_path body parameter
28+ // fmi_path body parameter
3229 // ========================================================================
3330
3431 @ Test
@@ -99,7 +96,7 @@ void fmiPath_NotIncludedWhenNull() throws Exception {
9996 }
10097
10198 // ========================================================================
102- // §3: Cache key isolation (ext_cache_key)
99+ // Cache key isolation (ext_cache_key)
103100 // ========================================================================
104101
105102 @ Test
@@ -226,7 +223,7 @@ void fmiPath_CacheDoesNotCollideWithNonFmiTokens() throws Exception {
226223 }
227224
228225 // ========================================================================
229- // §3: ext_cache_key hash computation
226+ // ext_cache_key hash computation
230227 // ========================================================================
231228
232229 @ Test
@@ -236,7 +233,7 @@ void computeExtCacheKeyHash_EmptyMapReturnsEmpty() {
236233 }
237234
238235 // ========================================================================
239- // §5: Assertion context — AssertionRequestOptions
236+ // Assertion context — AssertionRequestOptions
240237 // ========================================================================
241238
242239 @ Test
@@ -374,16 +371,16 @@ void fmiPath_WhitespaceOnlyThrowsIllegalArgumentException() {
374371 }
375372
376373 // ========================================================================
377- // §3: Exact cache key string validation (cross-SDK compatibility)
374+ // Exact cache key string validation (cross-SDK compatibility)
378375 // ========================================================================
379376
380377 @ Test
381- void fmiPath_CacheKeyFormat_MatchesDotNetFormat () throws Exception {
378+ void fmiPath_CacheKeyFormat_MatchesCrossSDKFormat () throws Exception {
382379 // This test verifies that the internal cache key produced by Java uses the correct
383380 // format: "-{env}-atext-{clientId}-{tenantId}-{scopes}-{hash}"
384- // Using the same fmi_path as .NET's Flow1 test : "SomeFmiPath/FmiCredentialPath"
381+ // Using the same fmi_path as other SDKs' integration tests : "SomeFmiPath/FmiCredentialPath"
385382 // Expected hash (case-sensitive): zm2n0E62zwTsnNsozptLsoOoB_C7i-GfpxHYQQINJUw
386- // The full cache key is lowercased (both .NET and Java do this) .
383+ // The full cache key is lowercased.
387384 // Java resolves login.microsoftonline.com → login.windows.net (preferred alias).
388385 DefaultHttpClient httpClientMock = mock (DefaultHttpClient .class );
389386
@@ -430,21 +427,21 @@ void fmiPath_CacheKeyFormat_MatchesDotNetFormat() throws Exception {
430427
431428 @ Test
432429 void fmiPath_HashValueMatchesCrossSDK () {
433- // Verify that the Java hash computation matches .NET for known inputs
430+ // Verify that the Java hash computation matches other MSAL SDKs for known inputs
434431 TreeMap <String , String > components = new TreeMap <>();
435432 components .put ("fmi_path" , "SomeFmiPath/FmiCredentialPath" );
436433
437434 String hash = StringHelper .computeExtCacheKeyHash (components );
438435 assertEquals ("zm2n0E62zwTsnNsozptLsoOoB_C7i-GfpxHYQQINJUw" , hash ,
439- "Hash for 'SomeFmiPath/FmiCredentialPath' should match .NET/Go/Python " );
436+ "Hash for 'SomeFmiPath/FmiCredentialPath' should match cross-SDK value " );
440437
441- // Second known value from .NET tests
438+ // Second known value
442439 TreeMap <String , String > components2 = new TreeMap <>();
443440 components2 .put ("fmi_path" , "SomeFmiPath/Path" );
444441
445442 String hash2 = StringHelper .computeExtCacheKeyHash (components2 );
446443 assertEquals ("7CX57Q63os7benQ6ER0sxgJPtNQSv7TGb5zexcidFoI" , hash2 ,
447- "Hash for 'SomeFmiPath/Path' should match .NET " );
444+ "Hash for 'SomeFmiPath/Path' should match cross-SDK value " );
448445 }
449446
450447 @ Test
0 commit comments