Search in sources :

Example 16 with MethodResult

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

the class MethodResultTest method constructorCreatesNewMethodResult_NullStatus.

@Test
public void constructorCreatesNewMethodResult_NullStatus() {
    //act
    MethodResult methodResult = new MethodResult(null, "TestObject");
    //assert
    assertNotNull(methodResult);
    assertNull(methodResult.getStatus());
    assertThat(methodResult.getPayload().toString(), is("TestObject"));
}
Also used : MethodResult(com.microsoft.azure.sdk.iot.service.devicetwin.MethodResult) Test(org.junit.Test)

Example 17 with MethodResult

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

the class MethodResultTest method constructorCreatesNewMethodResult.

/* Tests_SRS_METHODRESULT_21_001: [The constructor shall save the status and payload representing the method invoke result.] */
/* Tests_SRS_METHODRESULT_21_002: [There is no restrictions for these values, it can be empty, or null.] */
/* Tests_SRS_METHODRESULT_21_003: [The getStatus shall return the status stored by the constructor.] */
/* Tests_SRS_METHODRESULT_21_004: [The getPayload shall return the payload stored by the constructor.] */
@Test
public void constructorCreatesNewMethodResult() {
    //act
    MethodResult methodResult = new MethodResult(123, "TestObject");
    //assert
    assertNotNull(methodResult);
    assertThat(methodResult.getStatus(), is(123));
    assertThat(methodResult.getPayload().toString(), is("TestObject"));
}
Also used : MethodResult(com.microsoft.azure.sdk.iot.service.devicetwin.MethodResult) Test(org.junit.Test)

Aggregations

MethodResult (com.microsoft.azure.sdk.iot.service.devicetwin.MethodResult)17 Test (org.junit.Test)16 DeviceMethod (com.microsoft.azure.sdk.iot.service.devicetwin.DeviceMethod)2 IotHubException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubException)2 IotHubGatewayTimeoutException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubGatewayTimeoutException)2 IOException (java.io.IOException)2 IotHubNotFoundException (com.microsoft.azure.sdk.iot.service.exceptions.IotHubNotFoundException)1 SocketTimeoutException (java.net.SocketTimeoutException)1 URISyntaxException (java.net.URISyntaxException)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 LinkedList (java.util.LinkedList)1 CountDownLatch (java.util.concurrent.CountDownLatch)1