/** Test of toJson method, of class PdfWord. */ @Test public void testToJson() { assertTrue(instance.toJson() instanceof JSONObject); String expectedJson = "{\"layout\":[{\"width\":4.0,\"x\":0.0,\"y\":1.1,\"height\":1.1}],\"word\":{\"readable\":\"a\",\"normalised\":\"a\"}}"; StringWriter out = new StringWriter(); try { instance.toJson().writeJSONString(out); assertEquals(out.toString(), expectedJson); } catch (IOException ex) { fail("JSON data mismatch"); } }