MessageProcessingSequence implements IMessageProcessingSequence, IDumpable { @Override public void goTo(final int level, final int step) throws InvalidArgumentException { if (level > stackIndex || level < 0) { throw new InvalidArgumentException("Invalid level value"); } uncheckedGoTo(level, step); } MessageProcessingSequence(final int stackDepth, final IReceiverChain mainChain); @Override void reset(); @Override boolean next(); @Override void goTo(final int level, final int step); @Override void end(); @Override int getCurrentLevel(); @Override int getStepAtLevel(final int level); @Override IMessageReceiver getCurrentReceiver(); @Override IObject getCurrentReceiverArguments(); @Override void callChain(final IReceiverChain chain); @Override void catchException(final Throwable exception, final IObject context); @Override IObject dump(final IObject options);  }
@Test(expected = InvalidArgumentException.class) public void Should_goToThrow_When_positionIsOutOfRange() throws Exception { new MessageProcessingSequence(5, mainChainMock).goTo(-1, 0); }