@Test public void testGet() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); String result = fSDMsg.get("testFSDMsgFieldName"); assertNull("result", result); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testRead2() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); String result = fSDMsg.read(is, 0, "2C", null); assertEquals("result", "", result); }
@Test public void testHasField1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); boolean result = fSDMsg.hasField("testFSDMsgFieldName"); assertFalse("result", result); 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 testCopy() throws Throwable { FSDMsg msg = new FSDMsg("testFSDMsgBasePath"); msg.copy("testFSDMsgFieldName", msg); assertEquals("msg.fields.size()", 1, msg.fields.size()); assertNull("msg.fields.get(\"testFSDMsgFieldName\")", msg.fields.get("testFSDMsgFieldName")); }
@Test public void testGetInt1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); int result = fSDMsg.getInt("testFSDMsgName"); assertEquals("result", 0, result); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testRead1() throws Throwable { byte[] bytes = new byte[2]; FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); String result = fSDMsg.read(new ByteArrayInputStream(bytes), 0, " ", null); assertEquals("result", "", result); }
@Test public void testIsSeparator1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.setSeparator("testFSDMsgSeparatorName", ' '); boolean result = fSDMsg.isSeparator((byte) 32); assertTrue("result", result); }
@Test public void testGetHexBytesThrowsRuntimeException() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.set("testString", "testFSDMsgValue"); byte[] val = fSDMsg.getHexBytes("testString"); assertArrayEquals(ISOUtil.hex2byte("testFSDMsgValue"), val); }
@Test public void testGetHexBytes1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); byte[] result = fSDMsg.getHexBytes("testFSDMsgName"); assertNull("result", result); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@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 testToXML3() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); Element result = fSDMsg.toXML(); assertEquals("result.getName()", "message", result.getName()); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); }
@Test public void testGet8() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); String result = fSDMsg.get("testFSDMsgId", "Kv", 100, "testFSDMsgDefValue", null); assertEquals("result", "testFSDMsgDefValue", result); 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 testGetInt() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.set("testString", "1"); int result = fSDMsg.getInt("testString"); assertEquals("result", 1, result); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@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 testGet4() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.set(" is used, but ", "testFSDMsgValue"); String result = fSDMsg.get(" is used, but ", "Kv", 100, "testFSDMsgDefValue", null); assertEquals("result", "testFSDMsgDefValue", result); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testHasField() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); fSDMsg.readField(null, "testString", 0, "", null); boolean result = fSDMsg.hasField("testString"); assertTrue("result", result); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testReadField2() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); String result = fSDMsg.readField(is, "testFSDMsgFieldName", 0, "2C", null); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); assertEquals("result", "", result); }
@Test public void testReadField1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); byte[] bytes = new byte[1]; String result = fSDMsg.readField(new ByteArrayInputStream(bytes), "testFSDMsgFieldName", 1, "B", null); assertEquals("00", result); }
@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 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 testSetSeparator() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.setSeparator("testFSDMsgSeparatorName", ' '); assertEquals( "fSDMsg.separators.get(\"testFSDMsgSeparatorName\")", Character.valueOf(' '), fSDMsg.separators.get("testFSDMsgSeparatorName")); }
@Test public void testGetHexBytes() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.set("testString", "testFSDMsgValue1"); byte[] result = fSDMsg.getHexBytes("testString"); assertEquals("result.length", 8, result.length); assertEquals("result[0]", (byte) -2, result[0]); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testGetHexBytes2() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); byte[] bytes = new byte[1]; fSDMsg.readField(new ByteArrayInputStream(bytes), "testString", 0, "", null); byte[] result = fSDMsg.getHexBytes("testString"); assertEquals("result.length", 0, result.length); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); }
@Test public void testSet1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); fSDMsg.set("testFSDMsgName", "testFSDMsgValue"); assertEquals("fSDMsg.fields.size()", 1, fSDMsg.fields.size()); assertEquals( "fSDMsg.fields.get(\"testFSDMsgName\")", "testFSDMsgValue", fSDMsg.fields.get("testFSDMsgName")); }
@Test public void testGetSchemaThrowsMalformedURLException1() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); try { fSDMsg.getSchema("testFSDMsgMessage"); fail("Expected MalformedURLException to be thrown"); } catch (MalformedURLException ex) { assertEquals("ex.getClass()", MalformedURLException.class, ex.getClass()); } }
@Test public void testPack() throws Throwable { Element schema = new FSDMsg("testFSDMsgBasePath").toXML(); FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema"); StringBuffer sb = new StringBuffer(); fSDMsg.pack(schema, sb); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); assertEquals("schema.getName()", "message", schema.getName()); assertEquals("sb.toString()", "", sb.toString()); }
@Test public void testGetSchemaThrowsNullPointerException1() throws Throwable { FSDMsg fSDMsg = new FSDMsg(null, "testFSDMsgBaseSchema"); try { fSDMsg.getSchema("testFSDMsgMessage"); fail("Expected NullPointerException to be thrown"); } catch (NullPointerException ex) { assertNull("ex.getMessage()", ex.getMessage()); } }
@Test public void testUnpack() throws Throwable { FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath"); byte[] bytes = new byte[1]; InputStream is = new ByteArrayInputStream(bytes); Element schema = new Element("testFSDMsgName", "testFSDMsgUri"); fSDMsg.unpack(is, schema); assertEquals("fSDMsg.fields.size()", 0, fSDMsg.fields.size()); assertEquals("(ByteArrayInputStream) is.available()", 1, is.available()); assertEquals("schema.getName()", "testFSDMsgName", schema.getName()); }