added missing tests for Mqtt5DataTypes
@@ -212,6 +212,20 @@ public class Mqtt5DataTypesTest {
byteBuf.release();
}
+ @Test
+ public void test_decodeBinaryData_not_enough_bytes_for_length() {
+ final ByteBuf byteBuf = Unpooled.buffer();
+ byteBuf.writeByte(0);
+ assertNull(Mqtt5DataTypes.decodeBinaryData(byteBuf));
+ }
+
+ @Test
+ public void test_decodeBinaryData_not_enough_bytes_for_value() {
+ final ByteBuf byteBuf = Unpooled.buffer();
+ byteBuf.writeByte(0).writeByte(2).writeByte(1);
+ assertNull(Mqtt5DataTypes.decodeBinaryData(byteBuf));
+ }
+
@Test
public void test_encodeBinaryData_zero_length() {
final ByteBuf byteBuf = Unpooled.buffer();
