use of com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri in project azure-iot-sdk-java by Azure.
the class IotHubCompleteUriTest method toStringIsCorrect.
// Tests_SRS_IOTHUBCOMPLETEURI_11_002: [The string representation of the IoT Hub event URI shall be constructed with the format "[iotHubHostname]/devices/[deviceId]/messages/devicebound/[eTag]?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;
}
};
IotHubCompleteUri completeUri = new IotHubCompleteUri(iotHubHostname, deviceId, eTag);
String testUriStr = completeUri.toString();
final String expectedUriStr = uriStr;
assertThat(testUriStr, is(expectedUriStr));
}
use of com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri in project azure-iot-sdk-java by Azure.
the class IotHubCompleteUriTest method getHostnameIsCorrect.
// Tests_SRS_IOTHUBCOMPLETEURI_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;
}
};
IotHubCompleteUri completeUri = new IotHubCompleteUri(iotHubHostname, deviceId, eTag);
String testHostname = completeUri.getHostname();
final String expectedHostname = hostname;
assertThat(testHostname, is(expectedHostname));
}
use of com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri in project azure-iot-sdk-java by Azure.
the class IotHubCompleteUriTest method getHostnameIsCorrect.
// Tests_SRS_IOTHUBCOMPLETEURI_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;
}
};
IotHubCompleteUri completeUri = new IotHubCompleteUri(iotHubHostname, deviceId, eTag, null);
String testHostname = completeUri.getHostname();
assertThat(testHostname, is(hostname));
}
use of com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri in project azure-iot-sdk-java by Azure.
the class IotHubCompleteUriTest method getPathIsCorrect.
// Tests_SRS_IOTHUBCOMPLETEURI_11_004: [The function shall return a URI with the format '/devices/[deviceId]/messages/devicebound/[eTag].]
@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;
}
};
IotHubCompleteUri completeUri = new IotHubCompleteUri(iotHubHostname, deviceId, eTag);
String testPath = completeUri.getPath();
final String expectedPath = path;
assertThat(testPath, is(expectedPath));
}
use of com.microsoft.azure.sdk.iot.device.net.IotHubCompleteUri in project azure-iot-sdk-java by Azure.
the class IotHubCompleteUriTest method getPathIsCorrect.
// Tests_SRS_IOTHUBCOMPLETEURI_11_004: [The function shall return a URI with the format '/devices/[deviceId]/messages/devicebound/[eTag].]
@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;
}
};
IotHubCompleteUri completeUri = new IotHubCompleteUri(iotHubHostname, deviceId, eTag, null);
String testPath = completeUri.getPath();
assertThat(testPath, is(path));
}
Aggregations