@Test public void testSetHeader() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); byte[] h = new byte[2]; fSDMsg.setHeader(h); assertSame("fSDMsg.header", h, fSDMsg.header); }
@Test public void testGetHexHeader() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); byte[] h = new byte[1]; fSDMsg.setHeader(h); String result = fSDMsg.getHexHeader(); assertEquals("result", "", result); }
@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 testToXML() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); byte[] h = new byte[2]; fSDMsg.setHeader(h); Element result = fSDMsg.toXML(); assertEquals("result.getName()", "message", result.getName()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testGetHeader() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); byte[] h = new byte[2]; fSDMsg.setHeader(h); byte[] result = fSDMsg.getHeader(); assertSame("result", h, result); assertEquals("h[0]", (byte) 0, h[0]); }
@Test public void testGetHexHeaderThrowsStringIndexOutOfBoundsException() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); byte[] h = new byte[0]; fSDMsg.setHeader(h); try { fSDMsg.getHexHeader(); fail("Expected StringIndexOutOfBoundsException to be thrown"); } catch (StringIndexOutOfBoundsException ex) { assertEquals("ex.getMessage()", "String index out of range: -2", ex.getMessage()); } }
@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()); } }