JSONCodec { public static String createJC(Bridge bridge, String name, Reference handlerRef, boolean writeable, Reference callbackRef) { Map<String, Object> data = new HashMap<String, Object>(); data.put("name", name); data.put("writeable", Boolean.valueOf(writeable)); data.put("handler", handlerRef); if (callbackRef != null) { data.put("callback", callbackRef); } return createCommand(bridge, "JOINCHANNEL", data); }  static String createSEND(Bridge bridge, Reference destination,
			Object[] args); static String createJWP(Bridge bridge, String name,
			Reference callbackRef); static String createGETCHANNEL(Bridge bridge, String channelName); static String createLEAVECHANNEL(Bridge bridge, String name,
			Reference handlerRef, Reference callbackRef); static String createJC(Bridge bridge, String name,
			Reference handlerRef, boolean writeable,
			Reference callbackRef); static String createCONNECT(Bridge bridge, String sessionId,
			String secret, String apiKey); static Map<String, Object> parseRedirector(String result);  }
@Test public void testCreateJC() throws JsonParseException, JsonMappingException, IOException { String gen = JSONCodec.createJC(bridge, "CHANNEL", localRef, true, localRef); String spec = "{\"command\":\"JOINCHANNEL\",\"data\":{\"name\":\"CHANNEL\",\"writeable\":true,\"handler\":{\"ref\":[\"client\",\"abcdefgh\",\"RANDOM\"],\"operations\":[]},\"callback\":{\"ref\":[\"client\",\"abcdefgh\",\"RANDOM\"],\"operations\":[]}}}"; Map<String, Object> specObj = mapper.readValue(spec, new TypeReference<Map<String, Object>>() { }); Map<String, Object> genObj = mapper.readValue(gen, new TypeReference<Map<String, Object>>() { }); assertEquals(specObj, genObj); }