@Test public void jsonStringContent() throws Exception { ODataResponse response = mock(ODataResponse.class); when(response.getEntity()).thenReturn(STRING_CONTENT); when(response.getContentHeader()).thenReturn(HttpContentType.APPLICATION_OCTET_STREAM); assertEquals(STRING_CONTENT_JSON, appendJson(response)); when(response.getContentHeader()).thenReturn("image/png"); assertEquals(STRING_CONTENT_JSON, appendJson(response)); }
@Override public void appendJson(final JsonStreamWriter jsonStreamWriter) throws IOException { if (isJson) { jsonStreamWriter.unquotedValue(getContentString()); } else if (isText) { jsonStreamWriter.stringValue(getContentString()); } else { jsonStreamWriter.stringValueRaw(getContentString()); } }
DebugInfoBody implements DebugInfo { @Override public void appendJson(final JsonStreamWriter jsonStreamWriter) throws IOException { if (isJson) { jsonStreamWriter.unquotedValue(getContentString()); } else if (isText) { jsonStreamWriter.stringValue(getContentString()); } else { jsonStreamWriter.stringValueRaw(getContentString()); } } }
DebugInfoBody implements DebugInfo { @Override public void appendJson(final JsonStreamWriter jsonStreamWriter) throws IOException { if (isJson) { jsonStreamWriter.unquotedValue(getContentString()); } else if (isText) { jsonStreamWriter.stringValue(getContentString()); } else { jsonStreamWriter.stringValueRaw(getContentString()); } } DebugInfoBody(final ODataResponse response, final String serviceRoot); }
DebugInfoBody implements DebugInfo { @Override public void appendJson(final JsonStreamWriter jsonStreamWriter) throws IOException { if (isJson) { jsonStreamWriter.unquotedValue(getContentString()); } else if (isText) { jsonStreamWriter.stringValue(getContentString()); } else { jsonStreamWriter.stringValueRaw(getContentString()); } } DebugInfoBody(final ODataResponse response, final String serviceRoot); @Override String getName(); @Override void appendJson(final JsonStreamWriter jsonStreamWriter); @Override void appendHtml(final Writer writer); }
DebugInfoBody implements DebugInfo { @Override public void appendJson(final JsonStreamWriter jsonStreamWriter) throws IOException { if (isJson) { jsonStreamWriter.unquotedValue(getContentString()); } else if (isText) { jsonStreamWriter.stringValue(getContentString()); } else { jsonStreamWriter.stringValueRaw(getContentString()); } } DebugInfoBody(final ODataResponse response, final String serviceRoot); @Override String getName(); @Override void appendJson(final JsonStreamWriter jsonStreamWriter); @Override void appendHtml(final Writer writer);  }