FilterExpression implements Expression, Configurable { @Override public Result apply(PathData item, int depth) throws IOException { if (expression != null) { return expression.apply(item, -1); } return Result.PASS; } protected  FilterExpression(Expression expression); @Override void setOptions(FindOptions options); @Override void prepare(); @Override Result apply(PathData item, int depth); @Override void finish(); @Override String[] getUsage(); @Override String[] getHelp(); @Override boolean isAction(); @Override boolean isOperator(); @Override int getPrecedence(); @Override void addChildren(Deque<Expression> expressions); @Override void addArguments(Deque<String> args); @Override void setConf(Configuration conf); @Override Configuration getConf(); @Override String toString();  }
@Test public void apply() throws IOException { PathData item = mock(PathData.class); when(expr.apply(item, -1)).thenReturn(Result.PASS).thenReturn(Result.FAIL); assertEquals(Result.PASS, test.apply(item, -1)); assertEquals(Result.FAIL, test.apply(item, -1)); verify(expr, times(2)).apply(item, -1); verifyNoMoreInteractions(expr); }