Search in sources :

Example 1 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();
    final String expectedHostname = hostname;
    assertThat(testHostname, is(expectedHostname));
}
Also used : IotHubEventUri(com.microsoft.azure.sdk.iot.device.net.IotHubEventUri) NonStrictExpectations(mockit.NonStrictExpectations) Test(org.junit.Test)

Example 2 with IotHubEventUri

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

the class IotHubEventUriTest method toStringIsCorrect.

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

Example 3 with IotHubEventUri

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

the class IotHubEventUriIT method eventUriIsCorrect.

@Test
public void eventUriIsCorrect() throws URISyntaxException {
    String iotHubName = "test.iothub";
    String deviceId = "test-deviceid";
    IotHubEventUri uri = new IotHubEventUri(iotHubName, deviceId);
    String testUriStr = uri.toString();
    String expectedUriStr = "test.iothub/devices/test-deviceid/messages/events?api-version=2016-02-03";
    assertThat(testUriStr, is(expectedUriStr));
}
Also used : IotHubEventUri(com.microsoft.azure.sdk.iot.device.net.IotHubEventUri) Test(org.junit.Test)

Example 4 with IotHubEventUri

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

the class IotHubEventUriTest method toStringIsCorrect.

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

Example 5 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();
    final String expectedPath = path;
    assertThat(testPath, is(expectedPath));
}
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