Ejemplo n.º 1
0
 @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);
 }
Ejemplo n.º 2
0
 @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);
 }
Ejemplo n.º 3
0
 @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());
 }
Ejemplo n.º 4
0
 @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());
 }
Ejemplo n.º 5
0
 @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]);
 }
Ejemplo n.º 6
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());
   }
 }
Ejemplo n.º 7
0
 @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());
   }
 }