@Test public void shouldCallAsConsumer() { final ScriptEngineLambda lambda = new ScriptEngineLambda("nashorn", "a.setData('test')"); final Junk junk = new Junk(); lambda.accept(junk); assertEquals("test", junk.getData()); }
@Test public void shouldCallAsBiConsumer() { final ScriptEngineLambda lambda = new ScriptEngineLambda("nashorn", "a.setData('testa');b.setData('testb')"); final Junk junkA = new Junk(); final Junk junkB = new Junk(); lambda.accept(junkA, junkB); assertEquals("testa", junkA.getData()); assertEquals("testb", junkB.getData()); }