public void testConsumerThrowsScriptExceptionInProvide() throws Exception { String consumer = "class producer {\n" + " @Command\n" + " public org.crsh.command.Pipe<Integer, Object> main() {\n" + " return new org.crsh.command.Pipe<Integer, Object>() {\n" + " public void provide(Integer element) {\n" + " throw new org.crsh.command.ScriptException('foo')\n" + " }\n" + " };\n" + " }\n" + "}\n"; lifeCycle.bindClass("producer", Commands.ProduceInteger.class); lifeCycle.bindGroovy("consumer", consumer); Commands.list.clear(); Throwable t = assertError("producer | consumer", ErrorKind.EVALUATION); ScriptException ex = assertInstance(ScriptException.class, t); assertEquals("foo", ex.getMessage()); }