JSONCodec { public static String createCONNECT(Bridge bridge, String sessionId, String secret, String apiKey) { Map<String, Object> data = new HashMap<String, Object>(); List<String> session = Arrays.asList(sessionId, secret); data.put("session", session); data.put("api_key", apiKey); return createCommand(bridge, "CONNECT", 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 testCreateCONNECT() throws JsonParseException, JsonMappingException, IOException { String gen = JSONCodec.createCONNECT(bridge, null, null, "abcdefgh"); String spec = "{\"command\":\"CONNECT\",\"data\":{\"api_key\":\"abcdefgh\",\"session\":[null,null]}}"; 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); gen = JSONCodec.createCONNECT(bridge, "foo", "bar", "abcdefgh"); spec = "{\"command\":\"CONNECT\",\"data\":{\"api_key\":\"abcdefgh\",\"session\":[\"foo\", \"bar\"]}}"; specObj = mapper.readValue(spec, new TypeReference<Map<String, Object>>() { }); genObj = mapper.readValue(gen, new TypeReference<Map<String, Object>>() { }); assertEquals(specObj, genObj); }