/**
   * Actually does the test given the specified input markup and the expected output markup.
   *
   * @param input the markup (including real and pseudo markup)
   * @param expected the expected VDXML markup
   */
  protected void doTest(String input, String expected) throws Exception {

    InternalDevice internalDevice = InternalDeviceTestHelper.createTestDevice();

    ProtocolBuilder builder = new ProtocolBuilder();
    DOMProtocol protocol =
        (DOMProtocol)
            builder.build(new TestProtocolRegistry.TestDOMProtocolFactory(), internalDevice);

    Document document = DOMUtilities.read(DOMUtilities.getReader(), input);

    createTransformer().transform(protocol, document);

    String actual = DOMUtilities.toString(document, protocol.getCharacterEncoder());
    expected = DOMUtilities.provideDOMNormalizedString(expected, protocol.getCharacterEncoder());

    assertEquals("input: " + expected + " actual: " + actual, expected, actual);
  }
示例#2
0
 protected VolantisProtocol createTestableProtocol(InternalDevice internalDevice) {
   ProtocolBuilder builder = new ProtocolBuilder();
   VolantisProtocol protocol =
       builder.build(new TestProtocolRegistry.TestMHTMLFactory(), internalDevice);
   return protocol;
 }