@Test public void finish() throws IOException { test.addArguments(getArgs(TestExpression.class.getName())); test.finish(); verify(expr).addArguments(new LinkedList<String>()); verify(expr).finish(); verifyNoMoreInteractions(expr); }
@Test public void initialise() throws IOException { FindOptions options = new FindOptions(); test.addArguments(getArgs(TestExpression.class.getName())); test.initialise(options); verify(expr).addArguments(new LinkedList<String>()); verify(expr).initialise(options); verifyNoMoreInteractions(expr); }
@Test public void applyStop() throws IOException { PathData item = mock(PathData.class); when(expr.apply(item)).thenReturn(Result.STOP); test.addArguments(getArgs(TestExpression.class.getName())); assertEquals(Result.STOP, test.apply(item)); verify(expr).addArguments(new LinkedList<String>()); verify(expr).apply(item); verifyNoMoreInteractions(expr); }
@Test public void getPrecedence() throws IOException { when(expr.getPrecedence()).thenReturn(12345).thenReturn(67890); test.addArguments(getArgs(TestExpression.class.getName())); assertEquals(12345, test.getPrecedence()); assertEquals(67890, test.getPrecedence()); verify(expr).addArguments(new LinkedList<String>()); verify(expr, times(2)).getPrecedence(); verifyNoMoreInteractions(expr); }
@Test public void isAction() throws IOException { when(expr.isAction()).thenReturn(true).thenReturn(false); test.addArguments(getArgs(TestExpression.class.getName())); assertTrue(test.isAction()); assertFalse(test.isAction()); verify(expr).addArguments(new LinkedList<String>()); verify(expr, times(2)).isAction(); verifyNoMoreInteractions(expr); }
@Test public void addChildren() throws IOException { @SuppressWarnings("unchecked") LinkedList<Expression> children = mock(LinkedList.class); test.addArguments(getArgs(TestExpression.class.getName())); test.addChildren(children); verify(expr).addArguments(new LinkedList<String>()); verify(expr).addChildren(children); verifyNoMoreInteractions(expr); verifyNoMoreInteractions(children); }
@Test public void addArguments() throws IOException { test.addArguments(getArgs(TestExpression.class.getName() + " arg1 arg2 arg3")); verify(expr).addArguments(getArgs("arg1 arg2 arg3")); }