Search in sources :

Example 41 with MqttDeviceMethod

use of com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttDeviceMethod in project azure-iot-sdk-java by Azure.

the class MqttDeviceMethodTest method sendThrowsOnMessageNull.

// Tests_SRS_MqttDeviceMethod_25_016: [send method shall throw an exception if the message is null.]
@Test(expected = IllegalArgumentException.class)
public void sendThrowsOnMessageNull() throws TransportException {
    MqttDeviceMethod testMethod = new MqttDeviceMethod("", mockConnectOptions, new HashMap<Integer, Message>(), new ConcurrentLinkedQueue<Pair<String, byte[]>>());
    testMethod.start();
    // act
    testMethod.send(null);
}
Also used : Message(com.microsoft.azure.sdk.iot.device.Message) IotHubTransportMessage(com.microsoft.azure.sdk.iot.device.transport.IotHubTransportMessage) MqttDeviceMethod(com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttDeviceMethod) MutablePair(org.apache.commons.lang3.tuple.MutablePair) Pair(org.apache.commons.lang3.tuple.Pair) Test(org.junit.Test)

Aggregations

MqttDeviceMethod (com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttDeviceMethod)41 Test (org.junit.Test)41 Message (com.microsoft.azure.sdk.iot.device.Message)22 Verifications (mockit.Verifications)17 IotHubTransportMessage (com.microsoft.azure.sdk.iot.device.transport.IotHubTransportMessage)16 MutablePair (org.apache.commons.lang3.tuple.MutablePair)16 Pair (org.apache.commons.lang3.tuple.Pair)16 DeviceMethodMessage (com.microsoft.azure.sdk.iot.device.DeviceTwin.DeviceMethodMessage)14 ConcurrentSkipListMap (java.util.concurrent.ConcurrentSkipListMap)6 MqttIotHubConnection (com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttIotHubConnection)4 MqttDeviceTwin (com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttDeviceTwin)3 MqttMessaging (com.microsoft.azure.sdk.iot.device.transport.mqtt.MqttMessaging)3 DeviceOperations (com.microsoft.azure.sdk.iot.device.DeviceTwin.DeviceOperations)2 IotHubSasToken (com.microsoft.azure.sdk.iot.device.auth.IotHubSasToken)2 State (com.microsoft.azure.sdk.iot.device.transport.State)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 ConcurrentLinkedQueue (java.util.concurrent.ConcurrentLinkedQueue)2 NonStrictExpectations (mockit.NonStrictExpectations)2