Example #1
0
 @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());
 }
Example #2
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());
 }
Example #3
0
 @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());
   }
 }
Example #4
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());
   }
 }