Search in sources :

Example 96 with NonStrictExpectations

use of mockit.NonStrictExpectations in project azure-iot-sdk-java by Azure.

the class ProvisioningServiceClientTest method deleteDeviceRegistrationStateWithIdSucceed.

/* SRS_PROVISIONING_SERVICE_CLIENT_21_025: [The deleteDeviceRegistrationState shall delete the deviceRegistrationState for the provided id by calling the delete in the registrationStatusManager.] */
@Test
public void deleteDeviceRegistrationStateWithIdSucceed() throws ProvisioningServiceClientException {
    // arrange
    final String id = "valid-id";
    ProvisioningServiceClient provisioningServiceClient = createClient();
    new NonStrictExpectations() {

        {
            Deencapsulation.invoke(mockedRegistrationStatusManager, "delete", new Class[] { String.class, String.class }, id, null);
            times = 1;
        }
    };
    // act
    provisioningServiceClient.deleteDeviceRegistrationState(id);
// assert
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 97 with NonStrictExpectations

use of mockit.NonStrictExpectations in project azure-iot-sdk-java by Azure.

the class ProvisioningServiceClientTest method deleteIndividualEnrollmentWithRegistrationIdAndEtagSucceed.

/* SRS_PROVISIONING_SERVICE_CLIENT_21_013: [The deleteIndividualEnrollment shall delete the individualEnrollment for the provided registrationId and etag by calling the delete in the individualEnrollmentManager.] */
@Test
public void deleteIndividualEnrollmentWithRegistrationIdAndEtagSucceed() throws ProvisioningServiceClientException {
    // arrange
    final String registrationId = "valid-registration-id";
    final String eTag = "valid-eTag";
    ProvisioningServiceClient provisioningServiceClient = createClient();
    new NonStrictExpectations() {

        {
            Deencapsulation.invoke(mockedIndividualEnrollmentManager, "delete", registrationId, eTag);
            times = 1;
        }
    };
    // act
    provisioningServiceClient.deleteIndividualEnrollment(registrationId, eTag);
// assert
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 98 with NonStrictExpectations

use of mockit.NonStrictExpectations in project azure-iot-sdk-java by Azure.

the class ProvisioningServiceClientTest method deleteEnrollmentGroupWithEnrollmentGroupIdSucceed.

/* SRS_PROVISIONING_SERVICE_CLIENT_21_019: [The deleteEnrollmentGroup shall delete the enrollmentGroup for the provided enrollmentGroupId by calling the delete in the enrollmentGroupManager.] */
@Test
public void deleteEnrollmentGroupWithEnrollmentGroupIdSucceed() throws ProvisioningServiceClientException {
    // arrange
    final String enrollmentGroupId = "valid-enrollmentGroupId";
    ProvisioningServiceClient provisioningServiceClient = createClient();
    new NonStrictExpectations() {

        {
            Deencapsulation.invoke(mockedEnrollmentGroupManager, "delete", new Class[] { String.class, String.class }, enrollmentGroupId, null);
            times = 1;
        }
    };
    // act
    provisioningServiceClient.deleteEnrollmentGroup(enrollmentGroupId);
// assert
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 99 with NonStrictExpectations

use of mockit.NonStrictExpectations in project azure-iot-sdk-java by Azure.

the class ProvisioningServiceClientTest method deleteIndividualEnrollmentWithRegistrationIdSucceed.

/* SRS_PROVISIONING_SERVICE_CLIENT_21_012: [The deleteIndividualEnrollment shall delete the individualEnrollment for the provided registrationId by calling the delete in the individualEnrollmentManager.] */
@Test
public void deleteIndividualEnrollmentWithRegistrationIdSucceed() throws ProvisioningServiceClientException {
    // arrange
    final String registrationId = "valid-registration-id";
    ProvisioningServiceClient provisioningServiceClient = createClient();
    new NonStrictExpectations() {

        {
            Deencapsulation.invoke(mockedIndividualEnrollmentManager, "delete", new Class[] { String.class, String.class }, registrationId, null);
            times = 1;
        }
    };
    // act
    provisioningServiceClient.deleteIndividualEnrollment(registrationId);
// assert
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 100 with NonStrictExpectations

use of mockit.NonStrictExpectations in project azure-iot-sdk-java by Azure.

the class ProvisioningServiceClientTest method createRegistrationStateQueryWithPageSizeSucceed.

/* SRS_PROVISIONING_SERVICE_CLIENT_21_028: [The createEnrollmentGroupRegistrationStateQuery shall create a new deviceRegistrationState query by calling the createQuery in the registrationStatusManager.] */
@Test
public void createRegistrationStateQueryWithPageSizeSucceed(@Mocked final QuerySpecification mockedQuerySpecification) throws ProvisioningServiceClientException {
    // arrange
    final String enrollmentGroupId = "valid-enrollmentGroupId";
    ProvisioningServiceClient provisioningServiceClient = createClient();
    new NonStrictExpectations() {

        {
            Deencapsulation.invoke(mockedRegistrationStatusManager, "createEnrollmentGroupQuery", mockedQuerySpecification, enrollmentGroupId, 10);
            times = 1;
        }
    };
    // act
    Query query = provisioningServiceClient.createEnrollmentGroupRegistrationStateQuery(mockedQuerySpecification, enrollmentGroupId, 10);
    // assert
    assertNotNull(query);
}
Also used : ProvisioningConnectionString(com.microsoft.azure.sdk.iot.provisioning.service.auth.ProvisioningConnectionString) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Aggregations

NonStrictExpectations (mockit.NonStrictExpectations)476 Test (org.junit.Test)470 Verifications (mockit.Verifications)154 IotHubConnectionString (com.microsoft.azure.sdk.iot.service.IotHubConnectionString)77 IOException (java.io.IOException)64 HttpConnection (com.microsoft.azure.sdk.iot.service.transport.http.HttpConnection)51 HttpMethod (com.microsoft.azure.sdk.iot.service.transport.http.HttpMethod)51 DeviceTwin (com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin)47 MessageProperty (com.microsoft.azure.sdk.iot.device.MessageProperty)32 HttpsSingleMessage (com.microsoft.azure.sdk.iot.device.transport.https.HttpsSingleMessage)31 HttpConnection (com.microsoft.azure.sdk.iot.deps.transport.http.HttpConnection)26 HttpMethod (com.microsoft.azure.sdk.iot.deps.transport.http.HttpMethod)26 HttpsConnection (com.microsoft.azure.sdk.iot.device.transport.https.HttpsConnection)26 HttpsMethod (com.microsoft.azure.sdk.iot.device.transport.https.HttpsMethod)26 HashMap (java.util.HashMap)26 JobClient (com.microsoft.azure.sdk.iot.service.jobs.JobClient)25 IotHubConnectionString (com.microsoft.azure.sdk.iot.device.IotHubConnectionString)17 Date (java.util.Date)16 HashSet (java.util.HashSet)16 Query (com.microsoft.azure.sdk.iot.service.devicetwin.Query)15