Search in sources :

Example 1 with DefaultAzureCredential

use of com.azure.identity.DefaultAzureCredential in project vividus by vividus-framework.

the class CredentialFactoryTests method shouldCreateTokenCredential.

@Test
void shouldCreateTokenCredential() {
    DefaultAzureCredential defaultAzureCredential = mock(DefaultAzureCredential.class);
    try (MockedConstruction<DefaultAzureCredentialBuilder> credentialsBuilder = mockConstruction(DefaultAzureCredentialBuilder.class, (mock, context) -> when(mock.build()).thenReturn(defaultAzureCredential))) {
        assertEquals(defaultAzureCredential, CredentialFactory.createTokenCredential());
        assertThat(credentialsBuilder.constructed(), hasSize(1));
    }
}
Also used : DefaultAzureCredentialBuilder(com.azure.identity.DefaultAzureCredentialBuilder) DefaultAzureCredential(com.azure.identity.DefaultAzureCredential) Test(org.junit.jupiter.api.Test)

Aggregations

DefaultAzureCredential (com.azure.identity.DefaultAzureCredential)1 DefaultAzureCredentialBuilder (com.azure.identity.DefaultAzureCredentialBuilder)1 Test (org.junit.jupiter.api.Test)1