@@ -600,7 +600,7 @@ void managedIdentityTest_IMDSRetry() throws Exception {
600600 .build ();
601601
602602 // IMDS has different retry logic for certain status codes, such as 410
603- when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (410 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
603+ when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (HttpStatus . GONE . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
604604
605605 try {
606606 acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
@@ -612,7 +612,7 @@ void managedIdentityTest_IMDSRetry() throws Exception {
612612 }
613613
614614 clearInvocations (httpClientMock );
615- when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
615+ when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE ))).thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
616616
617617 try {
618618 acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
@@ -642,8 +642,8 @@ void managedIdentityTest_RetrySucceedsAfterFailure() throws Exception {
642642
643643 // First call returns 500, subsequent calls return 200
644644 when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE )))
645- .thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
646- .thenReturn (expectedResponse (200 , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
645+ .thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
646+ .thenReturn (expectedResponse (HttpStatus . OK . getCode () , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
647647
648648 IAuthenticationResult result = acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
649649
@@ -697,8 +697,8 @@ void managedIdentityTest_RetriesARePerRequest() throws Exception {
697697
698698 // First call returns 500, subsequent calls return 200
699699 when (httpClientMock .send (expectedRequest (IMDS , ManagedIdentityTestConstants .RESOURCE )))
700- .thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
701- .thenReturn (expectedResponse (200 , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
700+ .thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ))
701+ .thenReturn (expectedResponse (HttpStatus . OK . getCode () , getSuccessfulResponse (ManagedIdentityTestConstants .RESOURCE )));
702702
703703 IAuthenticationResult result = acquireTokenCommon (ManagedIdentityTestConstants .RESOURCE ).get ();
704704
@@ -710,7 +710,7 @@ void managedIdentityTest_RetriesARePerRequest() throws Exception {
710710
711711 //All calls return 500
712712 when (httpClientMock .send (expectedRequest (IMDS , "otherResource" )))
713- .thenReturn (expectedResponse (500 , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
713+ .thenReturn (expectedResponse (HttpStatus . INTERNAL_SERVER_ERROR . getCode () , ManagedIdentityTestConstants .MSI_ERROR_RESPONSE_500 ));
714714
715715 CompletableFuture <IAuthenticationResult > future = acquireTokenCommon ("otherResource" );
716716
0 commit comments