### Question:
TokenJsonSerializer implements JsonSerializer<Token> { public Token deserialize(JSONObject response) throws JSONException { Token token = new Token(); token.setToken(response.getString("token")); return token; }  Token deserialize(JSONObject response); List<Token> deserialize(JSONArray data); JSONObject serialize(Token object);  }### Answer:
@Test(expected = JSONException.class) public void deserializeFailure() throws JSONException { tokenJsonSerializer.deserialize(new JSONObject()); }
@Test(expected = RuntimeException.class) public void deserializeAllFailure() throws JSONException { tokenJsonSerializer.deserialize(new JSONArray()); }
@Test public void deserializeSuccess() throws JSONException { Map<Object, Object> jsonParams = new HashMap<>(); jsonParams.put("token", "token"); Token token = tokenJsonSerializer.deserialize(new JSONObject(jsonParams)); assertEquals("token", token.getToken()); }