XMLWorker implements XMLParserListener { public void endElement(final String tag, final String ns) { String thetag = null; if (parseHtml) { thetag = tag.toLowerCase(); } else { thetag = tag; } WorkerContext ctx = getLocalWC(); if (null != ctx.getCurrentTag() && !thetag.equals(ctx.getCurrentTag().getName())) { throw new RuntimeWorkerException(String.format( LocaleMessages.getInstance().getMessage(LocaleMessages.INVALID_NESTED_TAG), thetag, ctx.getCurrentTag().getName())); } Pipeline<?> wp = rootpPipe; ProcessObject po = new ProcessObject(); try { while (null != (wp = wp.close(ctx, ctx.getCurrentTag(), po))) ; } catch (PipelineException e) { throw new RuntimeWorkerException(e); } finally { if (null != ctx.getCurrentTag()) ctx.setCurrentTag(ctx.getCurrentTag().getParent()); } } XMLWorker(final Pipeline<?> pipeline, final boolean parseHtml); void init(); void startElement(final String tag, final Map<String, String> attr, final String ns); void endElement(final String tag, final String ns); void text(String text); void unknownText(final String text); void comment(final String comment); void close();  }
@Test public void verifyPipelineCloseCalled() { worker.endElement("test", "ns"); Assert.assertTrue(called); }