### Question:
VorzeA10CycloneCmd extends ButtplugDeviceMessage { public int getSpeed() { if (speed > 99 || speed < 0) { return 0; } return speed; } VorzeA10CycloneCmd(long deviceIndex, int speed, boolean clockwise, long id); @SuppressWarnings("unused")  VorzeA10CycloneCmd(int speed, boolean clockwise); @SuppressWarnings("unused") private  VorzeA10CycloneCmd(); int getSpeed(); void setSpeed(int speed); @JsonProperty(value = "Clockwise", required = true)
    public boolean clockwise; }### Answer:
@Test public void test() throws IOException { String testStr = "[\n" + " {\n" + " \"VorzeA10CycloneCmd\": {\n" + " \"Id\": 1,\n" + " \"DeviceIndex\": 0,\n" + " \"Speed\": 50,\n" + " \"Clockwise\": true\n" + " }\n" + " }\n" + "]"; ButtplugJsonMessageParser parser = new ButtplugJsonMessageParser(); List<ButtplugMessage> msgs = parser.deserialize(testStr); Assert.assertEquals(1, msgs.size()); Assert.assertEquals(VorzeA10CycloneCmd.class, msgs.get(0).getClass()); Assert.assertEquals(1, msgs.get(0).id); Assert.assertEquals(0, ((VorzeA10CycloneCmd) msgs.get(0)).deviceIndex); Assert.assertEquals(50, ((VorzeA10CycloneCmd) msgs.get(0)).getSpeed()); Assert.assertEquals(true, ((VorzeA10CycloneCmd) msgs.get(0)).clockwise); ObjectMapper objectMapper = new ObjectMapper(); JsonNode jsonNode = objectMapper.readValue(testStr, JsonNode.class); String uglyStr = jsonNode.toString(); String jsonOut = parser.serialize(msgs, 0); Assert.assertEquals(uglyStr, jsonOut); jsonOut = parser.serialize(msgs.get(0), 0); Assert.assertEquals(uglyStr, jsonOut); }