@Test public void testBadRequestToString() { ErrorMessage errorMessage = new ErrorMessage(new IllegalStateException(), BAD_REQUEST.getStatus()); assertEquals("{\n" + " \"error\": {\n" + " \"reason\": \"Invalid Query\",\n" + " \"details\": \"\",\n" + " \"type\": \"IllegalStateException\"\n" + " },\n" + " \"status\": 400\n" + "}", errorMessage.toString()); }
@Override public String toString() { JSONObject output = new JSONObject(); output.put("status", status); output.put("error", getErrorAsJson()); return output.toString(2); }
ErrorMessage { @Override public String toString() { JSONObject output = new JSONObject(); output.put("status", status); output.put("error", getErrorAsJson()); return output.toString(2); } }
ErrorMessage { @Override public String toString() { JSONObject output = new JSONObject(); output.put("status", status); output.put("error", getErrorAsJson()); return output.toString(2); } ErrorMessage(Exception exception, int status); }
ErrorMessage { @Override public String toString() { JSONObject output = new JSONObject(); output.put("status", status); output.put("error", getErrorAsJson()); return output.toString(2); } ErrorMessage(Exception exception, int status); @Override String toString(); }
ErrorMessage { @Override public String toString() { JSONObject output = new JSONObject(); output.put("status", status); output.put("error", getErrorAsJson()); return output.toString(2); } ErrorMessage(Exception exception, int status); @Override String toString();  }