@Test
public void testNth() throws RecognitionException {

  CommonTree sink = FlumeBuilder.parseSink(simple);
  PatternMatch pp = kind("DECO").nth(
      1,
      kind("DECO")
          .child(kind("SINK").child(var("node", kind("logicalNode")))));
  Map<String, CommonTree> m = pp.match(sink);
  assertNotNull(m);
  assertEquals(m.get("node").getText(), "logicalNode");
  dumpMatches(m);
  LOG.info(m);
  // This will attempt to match logicalNode to batch, which will fail
  pp = kind("DECO").nth(0,
      kind("SINK").child(var("node", kind("logicalNode"))));
  m = pp.match(sink);
  assertNull(m);
  dumpMatches(m);
  LOG.info(m);
}