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));
}
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));
}
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));
}
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));
}
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));
}
Aggregations