### Question:
UInt16 extends Message { public short getData() { return this.data; } UInt16();  UInt16(short data); short getData(); @Override UInt16 clone(); static UInt16 fromJsonString(java.lang.String jsonString); static UInt16 fromMessage(Message m); static UInt16 fromJsonObject(JsonObject jsonObject); static final java.lang.String FIELD_DATA; static final java.lang.String TYPE; }### Answer:
@Test public void testConstructor() { assertEquals((short) 0, empty.getData()); assertEquals("{\"data\":0}", empty.toString()); assertEquals(1, empty.toJsonObject().size()); assertEquals( (short) 0, Primitive.toUInt16((short) empty.toJsonObject().getInt( UInt16.FIELD_DATA))); assertEquals(UInt16.TYPE, empty.getMessageType()); }
@Test public void testByteConstructor() { assertEquals((short) 123, i1.getData()); assertEquals("{\"data\":123}", i1.toString()); assertEquals(1, i1.toJsonObject().size()); assertEquals( (short) 123, Primitive.toUInt16((short) i1.toJsonObject().getInt( UInt16.FIELD_DATA))); assertEquals(UInt16.TYPE, i1.getMessageType()); }
@Test public void testByteConstructorNegative() { UInt16 c = new UInt16((short) -1); assertEquals((short) -1, c.getData()); assertEquals("{\"data\":65535}", c.toString()); assertEquals(1, c.toJsonObject().size()); assertEquals( (short) -1, Primitive.toUInt16((short) c.toJsonObject().getInt( UInt16.FIELD_DATA))); assertEquals(UInt16.TYPE, c.getMessageType()); }