Parser extends RestcommUntypedActor { public Parser(final InputStream input, final String xml, final ActorRef sender) throws IOException { this(new InputStreamReader(input), xml, sender); } Parser(final InputStream input, final String xml, final ActorRef sender);  Parser(final Reader reader, final String xml, final ActorRef sender);  Parser(final String xml, final ActorRef sender); @Override void onReceive(final Object message);  }
@Test public void testParser() { final InputStream input = getClass().getResourceAsStream("/rcml.xml"); new JavaTestKit(system) { { final ActorRef observer = getRef(); final GetNextVerb next = new GetNextVerb(); final ActorRef parser = parser(input); parser.tell(next, observer); Tag verb = expectMsgClass(Tag.class); assertTrue(record.equals(verb.name())); assertTrue(verb.attribute("action").value().equals("https: assertTrue(verb.attribute("method").value().equals("GET")); assertTrue(verb.attribute("maxLength").value().equals("60")); assertTrue(verb.attribute("timeout").value().equals("5")); assertTrue(verb.attribute("finishOnKey").value().equals("#")); assertTrue(verb.attribute("transcribe").value().equals("true")); assertTrue(verb.attribute("transcribeCallback").value().equals("transcribe.jsp")); assertTrue(verb.attribute("playBeep").value().equals("false")); parser.tell(next, observer); verb = expectMsgClass(Tag.class); assertTrue(gather.equals(verb.name())); assertTrue(verb.attribute("timeout").value().equals("30")); assertTrue(verb.attribute("finishOnKey").value().equals("#")); assertTrue(verb.hasChildren()); final List<Tag> children = verb.children(); Tag child = children.get(0); assertTrue(say.equals(child.name())); assertTrue(child.attribute("voice").value().equals("man")); assertTrue(child.attribute("language").value().equals("en")); assertTrue(child.attribute("loop").value().equals("1")); assertTrue(child.text().equals("Hello World!")); child = children.get(1); assertTrue(play.equals(child.name())); assertTrue(child.attribute("loop").value().equals("1")); assertTrue(child.text().equals("https: child = children.get(2); assertTrue(pause.equals(child.name())); assertTrue(child.attribute("length").value().equals("1")); parser.tell(next, observer); expectMsgClass(End.class); } }; }