InputSelection extends EvaluationExpression { @Override public IJsonNode evaluate(final IJsonNode node, final IJsonNode target, final EvaluationContext context) { if (!node.isArray()) throw new EvaluationException("Cannot access index of non-array " + node.getClass().getSimpleName()); return ((IArrayNode) node).get(this.index); } InputSelection(final int index); @Override boolean equals(final Object obj); @Override IJsonNode evaluate(final IJsonNode node, final IJsonNode target, final EvaluationContext context); int getIndex(); @Override int hashCode(); @Override void toString(final StringBuilder builder);  }
@Test public void shouldSelectCorrectInput() { final IJsonNode result = new InputSelection(1).evaluate( createArrayNode(IntNode.valueOf(0), IntNode.valueOf(1)), null, this.context); Assert.assertEquals(IntNode.valueOf(1), result); }