TypedErrorMessage { public String toJSON() { return JSON.toJSON(this); } TypedErrorMessage(boolean failed, String message, Enum type);  TypedErrorMessage(String message, Enum type);  TypedErrorMessage(String message); boolean getFailed(); String getMessage(); Enum getType(); String toJSON(); @Override String toString();  }
@Test public void testBasicTypes() throws Exception { TypedErrorMessage typedErrorMessage = new TypedErrorMessage(true, "hello world", FakeErrorType.FAILURE_ON_LAUNCH); assertEquals("{\n" + " \"failed\" : true,\n" + " \"message\" : \"hello world\",\n" + " \"type\" : \"FAILURE_ON_LAUNCH\"\n" + "}", typedErrorMessage.toJSON()); }