Search in sources :

Example 6 with IotHubEventUri

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

the class IotHubEventUriTest method getHostnameIsCorrect.

// Tests_SRS_IOTHUBEVENTURI_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;
        }
    };
    IotHubEventUri eventUri = new IotHubEventUri(iotHubHostname, deviceId, "");
    String testHostname = eventUri.getHostname();
    assertThat(testHostname, is(hostname));
}
Also used : IotHubEventUri(com.microsoft.azure.sdk.iot.device.net.IotHubEventUri) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 7 with IotHubEventUri

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

the class IotHubEventUriTest method getPathIsCorrect.

// Tests_SRS_IOTHUBEVENTURI_11_004: [The function shall return a URI with the format '/devices/[deviceId]/messages/events'.]
@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;
        }
    };
    IotHubEventUri eventUri = new IotHubEventUri(iotHubHostname, deviceId, "");
    String testPath = eventUri.getPath();
    assertThat(testPath, is(path));
}
Also used : IotHubEventUri(com.microsoft.azure.sdk.iot.device.net.IotHubEventUri) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Aggregations

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