use of com.microsoft.azure.sdk.iot.service.FeedbackBatch in project azure-iot-sdk-java by Azure.
the class FeedbackBatchMessageTest method json_data_empty1.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKBATCHMESSAGE_12_002: [The function shall return an empty FeedbackBatch object if the content of the Data input is empty]
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKBATCHMESSAGE_12_003: [The function shall remove data batch brackets if they exist]
@Test
public void json_data_empty1() {
// Arrange
String jsonString = "Data{}";
// Act
FeedbackBatch feedbackBatch = FeedbackBatchMessage.parse(jsonString);
// Assert
assertNotNull(feedbackBatch);
}
use of com.microsoft.azure.sdk.iot.service.FeedbackBatch in project azure-iot-sdk-java by Azure.
the class FeedbackReceiverTest method receive_async_without_deviceId.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKRECEIVER_12_013: [The function shall create an async wrapper around the receive() function call]
@Test
public void receive_async_without_deviceId() throws Exception {
// Arrange
String hostName = "xxx";
String userName = "xxx";
String sasToken = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FeedbackReceiver feedbackReceiver = new FeedbackReceiver(hostName, userName, sasToken, iotHubServiceClientProtocol);
// Assert
new Expectations() {
{
amqpReceive.receive(Deencapsulation.getField(feedbackReceiver, "DEFAULT_TIMEOUT_MS"));
feedbackReceiver.receive();
}
};
// Act
CompletableFuture<FeedbackBatch> completableFuture = feedbackReceiver.receiveAsync();
completableFuture.get();
}
use of com.microsoft.azure.sdk.iot.service.FeedbackBatch in project azure-iot-sdk-java by Azure.
the class FeedbackBatchMessageTest method json_data_empty_array.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKBATCHMESSAGE_12_002: [The function shall return an empty FeedbackBatch object if the content of the Data input is empty]
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKBATCHMESSAGE_12_003: [The function shall remove data batch brackets if they exist]
@Test
public void json_data_empty_array() {
// Arrange
String jsonString = "Data{[]}";
// Act
FeedbackBatch feedbackBatch = FeedbackBatchMessage.parse(jsonString);
// Assert
assertNotNull(feedbackBatch);
}
use of com.microsoft.azure.sdk.iot.service.FeedbackBatch in project azure-iot-sdk-java by Azure.
the class FeedbackBatchMessageTest method json_data_invalid_format1.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKBATCHMESSAGE_12_004: [The function shall throw a JsonParsingException if the parsing failed]
// Assert
@Test(expected = JsonParsingException.class)
public void json_data_invalid_format1() {
// Arrange
String jsonString = "Data}";
// Act
FeedbackBatch feedbackBatch = FeedbackBatchMessage.parse(jsonString);
}
use of com.microsoft.azure.sdk.iot.service.FeedbackBatch in project azure-iot-sdk-java by Azure.
the class FeedbackBatchMessageTest method json_data_invalid_format3.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKBATCHMESSAGE_12_004: [The function shall throw a JsonParsingException if the parsing failed]
// Assert
@Test(expected = JsonParsingException.class)
public void json_data_invalid_format3() {
// Arrange
String jsonString = "Data{[}";
// Act
FeedbackBatch feedbackBatch = FeedbackBatchMessage.parse(jsonString);
}
Aggregations