Search in sources :

Example 11 with ServiceAuthenticationWithSharedAccessPolicyToken

use of com.microsoft.azure.sdk.iot.service.ServiceAuthenticationWithSharedAccessPolicyToken in project azure-iot-sdk-java by Azure.

the class AuthenticationMethodTest method getAuthenticationMethodSharedAccessToken.

/**
 * Test of ServiceAuthenticationWithSharedAccessPolicyToken class.
 * Create and get
 */
@Test
public void getAuthenticationMethodSharedAccessToken() throws Exception {
    // Arrange
    String policyName = "SharedAccessKey";
    String sharedAccessToken = "1234567890abcdefghijklmnopqrstvwxyz=";
    // Act
    ServiceAuthenticationWithSharedAccessPolicyToken serviceAuthenticationWithSharedAccessPolicyToken = new ServiceAuthenticationWithSharedAccessPolicyToken(policyName, sharedAccessToken);
    // Assert
    assertEquals("PolicyName mismatch!", policyName, serviceAuthenticationWithSharedAccessPolicyToken.getPolicyName());
    assertEquals("SharedAccessToken mismatch!", sharedAccessToken, serviceAuthenticationWithSharedAccessPolicyToken.getToken());
}
Also used : ServiceAuthenticationWithSharedAccessPolicyToken(com.microsoft.azure.sdk.iot.service.ServiceAuthenticationWithSharedAccessPolicyToken) Test(org.junit.Test)

Aggregations

ServiceAuthenticationWithSharedAccessPolicyToken (com.microsoft.azure.sdk.iot.service.ServiceAuthenticationWithSharedAccessPolicyToken)11 Test (org.junit.Test)11 IotHubConnectionString (com.microsoft.azure.sdk.iot.service.IotHubConnectionString)9 Expectations (mockit.Expectations)2