public void testNewLineAdded() throws Exception { final JSONJAXBContext ctx = new JSONJAXBContext( JSONConfiguration.natural().rootUnwrapping(false).humanReadableFormatting(true).build(), User.class); final JSONMarshaller jm = ctx.createJSONMarshaller(); final StringWriter sw = new StringWriter(); final User one = JSONTestHelper.createTestInstance(User.class); jm.marshallToJSON(one, sw); assertTrue(sw.toString().contains("\n")); }
public void _testNamespaces(JsonJaxbContext ctx) throws Exception { final JsonMarshaller jm = ctx.createJSONMarshaller(); final JsonUnmarshaller ju = ctx.createJSONUnmarshaller(); final StringWriter sw = new StringWriter(); final MyResponse one = JSONTestHelper.createTestInstance(MyResponse.class); jm.marshallToJSON(one, sw); System.out.println(String.format("%s", sw)); MyResponse two; two = ju.unmarshalFromJSON(new StringReader(sw.toString()), MyResponse.class); assertEquals(one, two); }