Search in sources :

Example 11 with AmqpMessage

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage in project azure-iot-sdk-java by Azure.

the class AmqpDeviceOperationsTest method ReceiverMessageFromLinkReceiverLinkNull.

@Test
public void ReceiverMessageFromLinkReceiverLinkNull() throws IOException {
    // Arrange
    AmqpDeviceOperations amqpDeviceOperation = new AmqpDeviceOperations();
    new NonStrictExpectations() {

        {
        }
    };
    // Act
    AmqpMessage result = amqpDeviceOperation.receiverMessageFromLink(TEST_SENDER_LINK_NAME);
    // assert
    Assert.assertNull(result);
}
Also used : AmqpDeviceOperations(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations) NonStrictExpectations(mockit.NonStrictExpectations) AmqpMessage(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage) Test(org.junit.Test)

Example 12 with AmqpMessage

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage in project azure-iot-sdk-java by Azure.

the class AmqpMessageTest method encodeSucceeds.

@Test
public void encodeSucceeds() throws IOException {
    AmqpMessage amqpMessage = new AmqpMessage(mockedMessageImpl);
    new NonStrictExpectations() {

        {
            mockedMessageImpl.decode((byte[]) any, 0, 10);
        }
    };
    byte[] data = new byte[10];
    amqpMessage.encode(data, 0);
}
Also used : NonStrictExpectations(mockit.NonStrictExpectations) AmqpMessage(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage) Test(org.junit.Test)

Example 13 with AmqpMessage

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage in project azure-iot-sdk-java by Azure.

the class AmqpMessageTest method setApplicationPropertySucceeds.

@Test
public void setApplicationPropertySucceeds() {
    AmqpMessage amqpMessage = new AmqpMessage(mockedMessageImpl);
    new NonStrictExpectations() {

        {
            mockedMessageImpl.setApplicationProperties((ApplicationProperties) any);
        }
    };
    Map<String, Object> userProperties = new HashMap<>();
    amqpMessage.setApplicationProperty(userProperties);
}
Also used : HashMap(java.util.HashMap) NonStrictExpectations(mockit.NonStrictExpectations) AmqpMessage(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage) Test(org.junit.Test)

Example 14 with AmqpMessage

use of com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage in project azure-iot-sdk-java by Azure.

the class AmqpMessageTest method getAmqpBodySucceeds.

@Test
public void getAmqpBodySucceeds() {
    AmqpMessage amqpMessage = new AmqpMessage(mockedMessageImpl);
    new NonStrictExpectations() {

        {
            mockedMessageImpl.getBody();
        }
    };
    amqpMessage.getAmqpBody();
}
Also used : NonStrictExpectations(mockit.NonStrictExpectations) AmqpMessage(com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage) Test(org.junit.Test)

Aggregations

AmqpMessage (com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpMessage)14 Test (org.junit.Test)14 NonStrictExpectations (mockit.NonStrictExpectations)12 AmqpDeviceOperations (com.microsoft.azure.sdk.iot.deps.transport.amqp.AmqpDeviceOperations)5 ProvisioningAmqpOperations (com.microsoft.azure.sdk.iot.provisioning.device.internal.contract.amqp.ProvisioningAmqpOperations)2 ProvisioningDeviceClientException (com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions.ProvisioningDeviceClientException)1 ProvisioningDeviceConnectionException (com.microsoft.azure.sdk.iot.provisioning.device.internal.exceptions.ProvisioningDeviceConnectionException)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1