Search in sources :

Example 1 with IotHubMessageUri

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

the class IotHubMessageUriTest method getPathIsCorrect.

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

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

Example 2 with IotHubMessageUri

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

the class IotHubMessageUriTest method getHostnameIsCorrect.

// Tests_SRS_IOTHUBMESSAGEURI_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 hostname = "test-hostname";
    new NonStrictExpectations() {

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

Example 3 with IotHubMessageUri

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

the class IotHubMessageUriTest method getPathIsCorrect.

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

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

Example 4 with IotHubMessageUri

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

the class IotHubMessageUriTest method toStringIsCorrect.

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

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

Example 5 with IotHubMessageUri

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

the class IotHubMessageUriTest method toStringIsCorrect.

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

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

Aggregations

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