use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification in project azure-iot-sdk-java by Azure.
the class AmqpResponseVerificationTest method constructor_saves_UNAUTHORIZED_ACCESS_exception.
//Tests_SRS_SERVICE_SDK_JAVA_AMQPRESPONSEVERIFICATION_25_004: [** The function shall save IotHubUnathorizedException if the amqp delivery state is rejected and error condition is amqp error code amqp:unauthorized-access **]**
@Test
public void constructor_saves_UNAUTHORIZED_ACCESS_exception() {
//Arrange
String errorDescription = "TestDescription";
new NonStrictExpectations() {
{
mockedRejected.getError();
result = mockedErrorCondition;
mockedErrorCondition.getCondition();
result = AmqpError.UNAUTHORIZED_ACCESS;
mockedErrorCondition.getDescription();
result = errorDescription;
}
};
//Act
AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedRejected);
//Assert
new Verifications() {
{
assertTrue(testVerification.getException() instanceof IotHubUnathorizedException);
}
};
}
use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification in project azure-iot-sdk-java by Azure.
the class AmqpResponseVerificationTest method constructor_saves_NOT_IMPLEMENTED_exception.
//Tests_SRS_SERVICE_SDK_JAVA_AMQPRESPONSEVERIFICATION_25_002: [** The function shall save IotHubNotSupportedException if the amqp delivery state is rejected and error condition is amqp error code amqp:not-implemented **]**
@Test
public void constructor_saves_NOT_IMPLEMENTED_exception() {
//Arrange
String errorDescription = "TestDescription";
new NonStrictExpectations() {
{
mockedRejected.getError();
result = mockedErrorCondition;
mockedErrorCondition.getCondition();
result = AmqpError.NOT_IMPLEMENTED;
mockedErrorCondition.getDescription();
result = errorDescription;
}
};
//Act
AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedRejected);
//Assert
new Verifications() {
{
assertTrue(testVerification.getException() instanceof IotHubNotSupportedException);
}
};
}
use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification in project azure-iot-sdk-java by Azure.
the class AmqpResponseVerificationTest method constructor_saves_if_rejected.
@Test
public void constructor_saves_if_rejected() {
//Arrange
new NonStrictExpectations() {
{
mockedRejected.getError();
result = mockedErrorCondition;
mockedErrorCondition.getCondition();
result = AmqpError.NOT_FOUND;
}
};
//Act
AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedRejected);
//Assert
new Verifications() {
{
assertNotNull(testVerification.getException());
}
};
}
Aggregations