Search in sources :

Example 6 with IotHubCompleteUri

use of com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri in project azure-iot-sdk-java by Azure.

the class IotHubCompleteUriTest method toStringIsCorrect.

// Tests_SRS_IOTHUBCOMPLETEURI_11_002: [The string representation of the IoT Hub event URI shall be constructed with the format "[iotHubHostname]/devices/[deviceId]/messages/devicebound/[eTag]?api-version=2016-02-03".]
@Test
public void toStringIsCorrect() throws URISyntaxException {
    final String iotHubHostname = "test.iothub";
    final String deviceId = "test-deviceid";
    final String eTag = "test-etag";
    final String uriStr = "test-uri-str";
    new NonStrictExpectations() {

        {
            mockIotHubUri.toString();
            result = uriStr;
        }
    };
    IotHubCompleteUri completeUri = new IotHubCompleteUri(iotHubHostname, deviceId, eTag, null);
    String testUriStr = completeUri.toString();
    assertThat(testUriStr, is(uriStr));
}
Also used : IotHubCompleteUri(com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Aggregations

IotHubCompleteUri (com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri)6 NonStrictExpectations (mockit.NonStrictExpectations)6 Test (org.junit.Test)6