Search in sources :

Example 6 with RegisterManager

use of com.microsoft.azure.sdk.iot.deps.twin.RegisterManager in project azure-iot-sdk-java by Azure.

the class RegisterManagerTest method setETagSucceed.

/* Tests_SRS_REGISTER_MANAGER_21_003: [The setETag shall replace the `eTag` by the provided one.] */
@Test
public void setETagSucceed() {
    // arrange
    Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().disableHtmlEscaping().create();
    RegisterManager result = gson.fromJson(REGISTER_MANAGER_SAMPLE, RegisterManager.class);
    // act
    result.setETag("yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyy");
    // assert
    assertEquals("yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyy", Deencapsulation.getField(result, "eTag"));
}
Also used : RegisterManager(com.microsoft.azure.sdk.iot.deps.twin.RegisterManager) GsonBuilder(com.google.gson.GsonBuilder) Gson(com.google.gson.Gson) Test(org.junit.Test)

Example 7 with RegisterManager

use of com.microsoft.azure.sdk.iot.deps.twin.RegisterManager in project azure-iot-sdk-java by Azure.

the class RegisterManagerTest method setDeviceIdThrowsOnNullDeviceId.

/* Tests_SRS_REGISTER_MANAGER_21_001: [The setDeviceId shall throw IllegalArgumentException if the provided deviceId do not fits the criteria.] */
@Test(expected = IllegalArgumentException.class)
public void setDeviceIdThrowsOnNullDeviceId() {
    // arrange
    Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().disableHtmlEscaping().create();
    RegisterManager result = gson.fromJson(REGISTER_MANAGER_SAMPLE, RegisterManager.class);
    // act - assert
    result.setDeviceId(null);
}
Also used : RegisterManager(com.microsoft.azure.sdk.iot.deps.twin.RegisterManager) GsonBuilder(com.google.gson.GsonBuilder) Gson(com.google.gson.Gson) Test(org.junit.Test)

Aggregations

Gson (com.google.gson.Gson)7 GsonBuilder (com.google.gson.GsonBuilder)7 RegisterManager (com.microsoft.azure.sdk.iot.deps.twin.RegisterManager)7 Test (org.junit.Test)7 DeviceCapabilities (com.microsoft.azure.sdk.iot.deps.twin.DeviceCapabilities)1