Ejemplo n.º 1
0
 @Test(expectedExceptions = IllegalStateException.class)
 public void parseInvalidXml() throws Exception {
   InputStream is = SbdhParserTest.class.getClassLoader().getResourceAsStream("sample-readme.txt");
   assertNotNull(is, "unable to locate sample-readme.txt in class path");
   SbdhParser sbdhParser = SbdhParserFactory.parserForSbdhOnly();
   StandardBusinessDocumentHeader sbdh = sbdhParser.parse(is);
 }
Ejemplo n.º 2
0
  @Test
  public void parseSampleSbdh() throws Exception {

    InputStream sbdhInputStream =
        SbdhParserTest.class.getClassLoader().getResourceAsStream(SBDH_SAMPLE_RESOURCE);
    assertNotNull(sbdhInputStream, "Unable to locate " + SBDH_SAMPLE_RESOURCE + " in class path");

    SbdhParser sbdhParser = SbdhParserFactory.parserForSbdhOnly();

    StandardBusinessDocumentHeader sbdh = sbdhParser.parse(sbdhInputStream);

    assertEquals(sbdh.getManifest().getNumberOfItems(), BigInteger.valueOf(2));
    int i = 0;
    for (ManifestItem manifestItem : sbdh.getManifest().getManifestItem()) {
      switch (i++) {
        case 0:
          assertEquals(
              manifestItem.getUniformResourceIdentifier(), "cid:trdm090-submit-tender-sample.xml");
          break;
        case 1:
          assertEquals(manifestItem.getUniformResourceIdentifier(), "cid:sample-readme.txt");
          break;
      }
    }
  }