use of com.microsoft.azure.sdk.iot.device.MessageProperty in project azure-iot-sdk-java by Azure.
the class MessageTest method setPropertyRejectsIllegalName.
// Tests_SRS_MESSAGE_11_030: [If name contains a character not specified in RFC 2047, the function shall throw an IllegalArgumentException.]
@Test(expected = IllegalArgumentException.class)
public void setPropertyRejectsIllegalName(@Mocked final MessageProperty mockProperty) {
final byte[] body = { 0x61, 0x62, 0x63 };
final String invalidName = " ";
final String value = "test-value";
new NonStrictExpectations() {
{
new MessageProperty(invalidName, value);
result = new IllegalArgumentException();
}
};
Message msg = new Message(body);
msg.setProperty(invalidName, value);
}
Aggregations