Search in sources :

Example 41 with ContractAPIHttp

use of com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.http.ContractAPIHttp in project azure-iot-sdk-java by Azure.

the class ContractAPIHttpTest method getRegistrationStatusThrowsOnNullOperationId.

// SRS_ContractAPIHttp_25_018: [If either operationId, registrationId, sslcontext or restResponseCallback is null or if operationId, registrationId is empty then this method shall throw ProvisioningDeviceClientException.]
@Test(expected = ProvisioningDeviceClientException.class)
public void getRegistrationStatusThrowsOnNullOperationId() throws ProvisioningDeviceClientException {
    // arrange
    ContractAPIHttp contractAPIHttp = createContractClass();
    new NonStrictExpectations() {

        {
            mockedRequestData.getOperationId();
            result = null;
            mockedRequestData.getRegistrationId();
            result = TEST_REGISTRATION_ID;
            mockedRequestData.getSslContext();
            result = mockedSslContext;
            mockedRequestData.getSasToken();
            result = null;
        }
    };
    // act
    contractAPIHttp.getRegistrationStatus(mockedRequestData, mockedResponseCallback, null);
}
Also used : ContractAPIHttp(com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.http.ContractAPIHttp) Test(org.junit.Test)

Aggregations

ContractAPIHttp (com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.http.ContractAPIHttp)41 Test (org.junit.Test)41 UrlPathBuilder (com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.UrlPathBuilder)12 DeviceRegistrationParser (com.microsoft.azure.sdk.iot.provisioning.device.internal.parser.DeviceRegistrationParser)7 Base64.encodeBase64String (org.apache.commons.codec.binary.Base64.encodeBase64String)5 IOException (java.io.IOException)4 ProvisioningDeviceClientContract (com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.ProvisioningDeviceClientContract)1 NonStrictExpectations (mockit.NonStrictExpectations)1