@Test public void should_backtrack() { when(machine.length()).thenReturn(1); expression.execute(machine); InOrder inOrder = Mockito.inOrder(machine); inOrder.verify(machine).length(); inOrder.verify(machine).backtrack(); verifyNoMoreInteractions(machine); }
@Override public void execute(Machine machine) { if (machine.length() == 0) { machine.jump(1); } else { machine.backtrack(); } }
EndOfInputExpression extends NativeExpression { @Override public void execute(Machine machine) { if (machine.length() == 0) { machine.jump(1); } else { machine.backtrack(); } } }
EndOfInputExpression extends NativeExpression { @Override public void execute(Machine machine) { if (machine.length() == 0) { machine.jump(1); } else { machine.backtrack(); } } private  EndOfInputExpression(); }
EndOfInputExpression extends NativeExpression { @Override public void execute(Machine machine) { if (machine.length() == 0) { machine.jump(1); } else { machine.backtrack(); } } private  EndOfInputExpression(); @Override void execute(Machine machine); @Override String toString(); }
EndOfInputExpression extends NativeExpression { @Override public void execute(Machine machine) { if (machine.length() == 0) { machine.jump(1); } else { machine.backtrack(); } } private  EndOfInputExpression(); @Override void execute(Machine machine); @Override String toString(); static final EndOfInputExpression INSTANCE; }