Search in sources :

Example 6 with AmqpResponseVerification

use of com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification in project azure-iot-sdk-java by Azure.

the class AmqpResponseVerificationTest method getExceptionGets.

//Tests_SRS_SERVICE_SDK_JAVA_AMQPRESPONSEVERIFICATION_25_007: [** The function shall return the exception saved earlier by the constructor **]**
@Test
public void getExceptionGets() {
    //Arrange
    String errorDescription = "TestDescription";
    new NonStrictExpectations() {

        {
            mockedRejected.getError();
            result = mockedErrorCondition;
            mockedErrorCondition.getCondition();
            result = AmqpError.RESOURCE_LIMIT_EXCEEDED;
            mockedErrorCondition.getDescription();
            result = errorDescription;
        }
    };
    //Act
    AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedRejected);
    //Assert
    new Verifications() {

        {
            assertTrue(testVerification.getException() instanceof IotHubDeviceMaximumQueueDepthExceededException);
        }
    };
}
Also used : Verifications(mockit.Verifications) NonStrictExpectations(mockit.NonStrictExpectations) AmqpResponseVerification(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification) Test(org.junit.Test)

Example 7 with AmqpResponseVerification

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_accepted.

//Tests_SRS_SERVICE_SDK_JAVA_AMQPRESPONSEVERIFICATION_25_006: [** The function shall save null exception if the amqp delivery state is accepted or received or released or modified **]**
@Test
public void constructor_saves_if_accepted() {
    //Act
    AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedAccepted);
    //Assert
    new Verifications() {

        {
            assertNull(testVerification.getException());
        }
    };
}
Also used : Verifications(mockit.Verifications) AmqpResponseVerification(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification) Test(org.junit.Test)

Example 8 with AmqpResponseVerification

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_modified.

@Test
public void constructor_saves_if_modified() {
    //Act
    AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedModified);
    //Assert
    new Verifications() {

        {
            assertNull(testVerification.getException());
        }
    };
}
Also used : Verifications(mockit.Verifications) AmqpResponseVerification(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification) Test(org.junit.Test)

Example 9 with AmqpResponseVerification

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_FOUND_exception.

//Tests_SRS_SERVICE_SDK_JAVA_AMQPRESPONSEVERIFICATION_25_001: [** The function shall save IotHubNotFoundException if the amqp delivery state is rejected and error condition is amqp error code amqp:not-found **]**
@Test
public void constructor_saves_NOT_FOUND_exception() {
    //Arrange
    String errorDescription = "TestDescription";
    new NonStrictExpectations() {

        {
            mockedRejected.getError();
            result = mockedErrorCondition;
            mockedErrorCondition.getCondition();
            result = AmqpError.NOT_FOUND;
            mockedErrorCondition.getDescription();
            result = errorDescription;
        }
    };
    //Act
    AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedRejected);
    //Assert
    new Verifications() {

        {
            assertTrue(testVerification.getException() instanceof IotHubNotFoundException);
        }
    };
}
Also used : Verifications(mockit.Verifications) NonStrictExpectations(mockit.NonStrictExpectations) AmqpResponseVerification(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification) Test(org.junit.Test)

Example 10 with AmqpResponseVerification

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_received.

@Test
public void constructor_saves_if_received() {
    //Act
    AmqpResponseVerification testVerification = new AmqpResponseVerification(mockedReceived);
    //Assert
    new Verifications() {

        {
            assertNull(testVerification.getException());
        }
    };
}
Also used : Verifications(mockit.Verifications) AmqpResponseVerification(com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification) Test(org.junit.Test)

Aggregations

AmqpResponseVerification (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpResponseVerification)13 Test (org.junit.Test)13 Verifications (mockit.Verifications)11 NonStrictExpectations (mockit.NonStrictExpectations)7 IotHubServiceClientProtocol (com.microsoft.azure.sdk.iot.service.IotHubServiceClientProtocol)2 AmqpSendHandler (com.microsoft.azure.sdk.iot.service.transport.amqps.AmqpSendHandler)2 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)2 Expectations (mockit.Expectations)2