コード例 #1
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #2
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
  @Test
  public void testRead2() throws Throwable {
    FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath", "testFSDMsgBaseSchema");

    String result = fSDMsg.read(is, 0, "2C", null);
    assertEquals("result", "", result);
  }
コード例 #3
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #4
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #5
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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"));
 }
コード例 #6
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #7
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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);
 }
コード例 #8
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @Test
 public void testIsSeparator1() throws Throwable {
   FSDMsg fSDMsg = new FSDMsg("testFSDMsgBasePath");
   fSDMsg.setSeparator("testFSDMsgSeparatorName", ' ');
   boolean result = fSDMsg.isSeparator((byte) 32);
   assertTrue("result", result);
 }
コード例 #9
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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);
 }
コード例 #10
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #11
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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);
 }
コード例 #12
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #13
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #14
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #15
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #16
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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);
 }
コード例 #17
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #18
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #19
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
  @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);
  }
コード例 #20
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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);
 }
コード例 #21
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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]);
 }
コード例 #22
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #23
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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"));
 }
コード例 #24
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #25
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #26
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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"));
 }
コード例 #27
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
   }
 }
コード例 #28
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }
コード例 #29
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
   }
 }
コード例 #30
0
ファイル: FSDMsgTest.java プロジェクト: nachmadi/jPOS
 @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());
 }