use of com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin in project azure-iot-sdk-java by Azure.
the class DeviceTwinTest method replaceDesiredPropertiesThrowsIfJsonIsEmpty.
@Test(expected = IOException.class)
public void replaceDesiredPropertiesThrowsIfJsonIsEmpty() throws Exception {
//arrange
final String connectionString = "testString";
DeviceTwin testTwin = DeviceTwin.createFromConnectionString(connectionString);
new NonStrictExpectations() {
{
mockedDevice.getDeviceId();
result = "SomeDevID";
Deencapsulation.invoke(mockedDevice, "getTwinParser");
result = mockedTwinParser;
mockedTwinParser.resetDesiredProperty((Map<String, Object>) any);
result = "";
}
};
//act
testTwin.replaceDesiredProperties(mockedDevice);
//assert
new Verifications() {
{
mockedConnectionString.getUrlTwinDesired(anyString);
times = 1;
mockedTwinParser.resetDesiredProperty((Map<String, Object>) any);
times = 1;
}
};
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin in project azure-iot-sdk-java by Azure.
the class DeviceTwinTest method updateTwinThrowsIfDeviceIDIsNull.
@Test(expected = IllegalArgumentException.class)
public void updateTwinThrowsIfDeviceIDIsNull() throws Exception {
//arrange
final String connectionString = "testString";
DeviceTwin testTwin = DeviceTwin.createFromConnectionString(connectionString);
new NonStrictExpectations() {
{
mockedDevice.getDeviceId();
result = null;
}
};
//act
testTwin.updateTwin(mockedDevice);
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin in project azure-iot-sdk-java by Azure.
the class DeviceTwinTest method replaceTagsThrowsIfDeviceIDIsNull.
@Test(expected = IllegalArgumentException.class)
public void replaceTagsThrowsIfDeviceIDIsNull() throws Exception {
//arrange
final String connectionString = "testString";
DeviceTwin testTwin = DeviceTwin.createFromConnectionString(connectionString);
new NonStrictExpectations() {
{
mockedDevice.getDeviceId();
result = null;
}
};
//act
testTwin.replaceTags(mockedDevice);
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin in project azure-iot-sdk-java by Azure.
the class DeviceTwinTest method getTwinThrowsOnNullDevice.
/*
**Tests_SRS_DEVICETWIN_25_004: [** The function shall throw IllegalArgumentException if the input device is null or if deviceId is null or empty **]**
*/
@Test(expected = IllegalArgumentException.class)
public void getTwinThrowsOnNullDevice() throws Exception {
//arrange
final String connectionString = "testString";
DeviceTwin testTwin = DeviceTwin.createFromConnectionString(connectionString);
//act
testTwin.getTwin(null);
}
use of com.microsoft.azure.sdk.iot.service.devicetwin.DeviceTwin in project azure-iot-sdk-java by Azure.
the class DeviceTwinTest method constructorThrowsOnNullCS.
/*
**Tests_SRS_DEVICETWIN_25_001: [** The constructor shall throw IllegalArgumentException if the input string is null or empty **]**
*/
@Test(expected = IllegalArgumentException.class)
public void constructorThrowsOnNullCS() throws Exception {
//arrange
final String connectionString = null;
//act
DeviceTwin testTwin = DeviceTwin.createFromConnectionString(connectionString);
}
Aggregations