use of com.microsoft.azure.sdk.iot.service.FeedbackBatch in project azure-iot-sdk-java by Azure.
the class FeedbackBatchMessageTest method json_empty.
// Tests_SRS_SERVICE_SDK_JAVA_FEEDBACKBATCHMESSAGE_12_001: [The function shall return an empty FeedbackBatch object if the input is empty or null]
@Test
public void json_empty() {
// Arrange
String jsonString = "";
// 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_format4.
// 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_format4() {
// 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_format2.
// 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]
@Test
public void json_data_invalid_format2() {
// 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_format6.
// 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_format6() {
// Arrange
String jsonString = "[,xxx]";
// 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 FeedbackReceiverTest method receive_async.
// 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() throws Exception {
// Arrange
String hostName = "xxx";
String userName = "xxx";
String sasToken = "xxx";
String deviceId = "xxx";
IotHubServiceClientProtocol iotHubServiceClientProtocol = IotHubServiceClientProtocol.AMQPS;
FeedbackReceiver feedbackReceiver = new FeedbackReceiver(hostName, userName, sasToken, iotHubServiceClientProtocol, deviceId);
// Assert
new Expectations() {
{
amqpReceive.receive(Deencapsulation.getField(feedbackReceiver, "DEFAULT_TIMEOUT_MS"));
feedbackReceiver.receive();
}
};
// Act
CompletableFuture<FeedbackBatch> completableFuture = feedbackReceiver.receiveAsync();
completableFuture.get();
}
Aggregations