Search in sources :

Example 11 with MethodParser

use of com.microsoft.azure.sdk.iot.deps.serializer.MethodParser in project azure-iot-sdk-java by Azure.

the class MethodParserTest method toJson_failed.

/* Tests_SRS_METHODPARSER_21_036: [If the method operation is `none`, the toJson shall throw IllegalArgumentException.] */
@Test(expected = IllegalArgumentException.class)
public void toJson_failed() {
    // Arrange
    MethodParser methodParser = new MethodParser();
    // Act
    methodParser.toJson();
}
Also used : MethodParser(com.microsoft.azure.sdk.iot.deps.serializer.MethodParser) Test(org.junit.Test)

Example 12 with MethodParser

use of com.microsoft.azure.sdk.iot.deps.serializer.MethodParser in project azure-iot-sdk-java by Azure.

the class MethodParserTest method toJson_payload_succeed.

/**
     * Tests_SRS_METHODPARSER_21_028: [If the method operation is `payload`, the toJson shall parse only the payload.]
     *  Ex:
     *  {
     *      "input1": "someInput",
     *      "input2": "anotherInput"
     *  }
     */
@Test
public void toJson_payload_succeed() {
    for (TestMethod testCase : successTestResult) {
        // Arrange
        MethodParser methodParser = new MethodParser(testCase.payload);
        // Act
        String json = methodParser.toJson();
        // Assert
        Helpers.assertJson(json, testCase.json);
    }
}
Also used : MethodParser(com.microsoft.azure.sdk.iot.deps.serializer.MethodParser) Test(org.junit.Test)

Example 13 with MethodParser

use of com.microsoft.azure.sdk.iot.deps.serializer.MethodParser in project azure-iot-sdk-java by Azure.

the class MethodParserTest method Constructor_succeed.

/* Tests_SRS_METHODPARSER_21_029: [The constructor shall create an instance of the methodParser.] */
/* Tests_SRS_METHODPARSER_21_030: [The constructor shall initialize all data in the collection as null.] */
/* Tests_SRS_METHODPARSER_21_022: [The constructor shall initialize the method operation as `none`.] */
@Test
public void Constructor_succeed() {
    // Arrange
    // Act
    MethodParser methodParser = new MethodParser();
    // Assert
    assertMethod(methodParser, null, null, null, null, null, "none");
}
Also used : MethodParser(com.microsoft.azure.sdk.iot.deps.serializer.MethodParser) Test(org.junit.Test)

Aggregations

MethodParser (com.microsoft.azure.sdk.iot.deps.serializer.MethodParser)13 Test (org.junit.Test)12 IotHubConnectionString (com.microsoft.azure.sdk.iot.service.IotHubConnectionString)1 HttpResponse (com.microsoft.azure.sdk.iot.service.transport.http.HttpResponse)1 URL (java.net.URL)1