Search in sources :

Example 1 with IotHubAbandonUri

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

the class IotHubAbandonUriTest method toStringIsCorrect.

// Tests_SRS_IOTHUBABANDONURI_11_002: [The string representation of the IoT Hub event URI shall be constructed with the format "[iotHubHostname]/devices/[deviceId]/messages/devicebound/[eTag]/abandon?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;
        }
    };
    IotHubAbandonUri abandonUri = new IotHubAbandonUri(iotHubHostname, deviceId, eTag);
    String testUriStr = abandonUri.toString();
    final String expectedUriStr = uriStr;
    assertThat(testUriStr, is(expectedUriStr));
}
Also used : IotHubAbandonUri(com.microsoft.azure.sdk.iot.device.net.IotHubAbandonUri) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 2 with IotHubAbandonUri

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

the class IotHubAbandonUriTest method getPathIsCorrect.

// Tests_SRS_IOTHUBABANDONURI_11_004: [The function shall return a URI with the format '/devices/[deviceId]/messages/devicebound/[eTag]/abandon'.]
@Test
public void getPathIsCorrect() throws URISyntaxException {
    final String iotHubHostname = "test.iothub";
    final String deviceId = "test-deviceid";
    final String eTag = "test-etag";
    final String path = "test-path";
    new NonStrictExpectations() {

        {
            mockIotHubUri.getPath();
            result = path;
        }
    };
    IotHubAbandonUri abandonUri = new IotHubAbandonUri(iotHubHostname, deviceId, eTag);
    String testPath = abandonUri.getPath();
    final String expectedPath = path;
    assertThat(testPath, is(expectedPath));
}
Also used : IotHubAbandonUri(com.microsoft.azure.sdk.iot.device.net.IotHubAbandonUri) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 3 with IotHubAbandonUri

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

the class IotHubAbandonUriTest method getHostnameIsCorrect.

// Tests_SRS_IOTHUBABANDONURI_11_003: [The function shall return the hostname given in the constructor.] 
@Test
public void getHostnameIsCorrect() throws URISyntaxException {
    final String iotHubHostname = "test.iothub";
    final String deviceId = "test-deviceid";
    final String eTag = "test-etag";
    final String hostname = "test-hostname";
    new NonStrictExpectations() {

        {
            mockIotHubUri.getHostname();
            result = hostname;
        }
    };
    IotHubAbandonUri abandonUri = new IotHubAbandonUri(iotHubHostname, deviceId, eTag);
    String testHostname = abandonUri.getHostname();
    final String expectedHostname = hostname;
    assertThat(testHostname, is(expectedHostname));
}
Also used : IotHubAbandonUri(com.microsoft.azure.sdk.iot.device.net.IotHubAbandonUri) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Aggregations

IotHubAbandonUri (com.microsoft.azure.sdk.iot.device.net.IotHubAbandonUri)3 NonStrictExpectations (mockit.NonStrictExpectations)3 Test (org.junit.Test)3