|
31 | 31 | import com.azure.core.test.annotation.DoNotRecord; |
32 | 32 | import com.azure.core.test.http.MockHttpResponse; |
33 | 33 | import com.azure.core.test.models.CustomMatcher; |
| 34 | +import com.azure.core.test.utils.MockTokenCredential; |
34 | 35 | import com.azure.core.util.ClientOptions; |
35 | 36 | import com.azure.core.util.Configuration; |
36 | 37 | import com.azure.core.util.Header; |
@@ -263,7 +264,6 @@ public void clientBuilderWithNewLanguageForBatchOperation(HttpClient httpClient, |
263 | 264 | }); |
264 | 265 | } |
265 | 266 |
|
266 | | - @Disabled("Waiting for service to enable it") |
267 | 267 | @ParameterizedTest(name = DISPLAY_NAME_WITH_ARGUMENTS) |
268 | 268 | @MethodSource("com.azure.ai.textanalytics.TestUtils#getTestParameters") |
269 | 269 | public void clientBuilderWithAAD(HttpClient httpClient, TextAnalyticsServiceVersion serviceVersion) { |
@@ -434,14 +434,17 @@ void clientBuilderWithAadRunner(HttpClient httpClient, TextAnalyticsServiceVersi |
434 | 434 | .pipeline(getHttpPipeline(httpClient)) |
435 | 435 | .serviceVersion(serviceVersion); |
436 | 436 |
|
437 | | - if (interceptorManager.isPlaybackMode()) { |
| 437 | + if (interceptorManager.isRecordMode()) { |
| 438 | + clientBuilder.addPolicy(interceptorManager.getRecordPolicy()); |
| 439 | + } else if (interceptorManager.isPlaybackMode()) { |
438 | 440 | // since running in playback mode won't have the token credential, so skipping matching it. |
439 | 441 | interceptorManager.addMatchers(Arrays.asList( |
440 | 442 | new CustomMatcher().setExcludedHeaders(Arrays.asList("Authorization")))); |
441 | | - } |
442 | 443 |
|
443 | | - if (interceptorManager.isRecordMode()) { |
444 | | - clientBuilder.addPolicy(interceptorManager.getRecordPolicy()); |
| 444 | + clientBuilder.credential(new MockTokenCredential()); |
| 445 | + } |
| 446 | + if (!interceptorManager.isPlaybackMode()) { |
| 447 | + clientBuilder.credential(new DefaultAzureCredentialBuilder().build()); |
445 | 448 | } |
446 | 449 |
|
447 | 450 | testRunner.apply(clientBuilder).accept(DETECT_LANGUAGE_INPUTS.get(0), DETECTED_LANGUAGE_ENGLISH); |
|
0 commit comments