public void dump (PrintStream p, String indent) { if (fsd != null) fsd.dump (p, indent); } public void writeExternal (ObjectOutput out) throws IOException {
@Test public void testDump2() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); fSDMsg.dump(new PrintStream(new ByteArrayOutputStream(), true, "UTF-16"), "testFSDMsgIndent"); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testDump3() throws Throwable { byte[] h = new byte[3]; FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); fSDMsg.setHeader(h); fSDMsg.dump(new PrintStream(new ByteArrayOutputStream(), true, "UTF-16"), "testFSDMsgIndent"); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testDump1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.copy("testFSDMsgFieldName", new FSDMsg("testFSDMsgBasePath1")); fSDMsg.dump(new PrintStream(new ByteArrayOutputStream(), true, "UTF-16"), "testFSDMsgIndent"); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testDump() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.copy("testFSDMsgFieldName", new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema")); byte[] h = new byte[3]; fSDMsg.setHeader(h); fSDMsg.dump(new PrintStream(new ByteArrayOutputStream(), true, "UTF-16"), "testFSDMsgIndent"); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testDumpThrowsNullPointerException() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); try { fSDMsg.dump(null, "testFSDMsgIndent"); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }
@Test public void testDumpThrowsStringIndexOutOfBoundsException() throws Throwable { byte[] h = new byte[0]; FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); fSDMsg.setHeader(h); PrintStream p = new PrintStream(new ByteArrayOutputStream(), true, "UTF-16"); try { fSDMsg.dump(p, "testFSDMsgIndent"); fail("Expected StringIndexOutOfBoundsException to be thrown"); } catch (StringIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "String index out of range: -2", ex.getMessage()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); } }