RepeaterActor { public void handle(final IRepeatRequest request) throws ReadValueException, InvalidArgumentException { if (request.repeat()) { IMessageProcessingSequence sequence = request.getSequence(); sequence.goTo(sequence.getCurrentLevel(), 0); } }  void handle(final IRepeatRequest request);  }
@Test public void Should_repeaterRepeatChainWhenRequired() throws Exception { when(sequenceMock.getCurrentLevel()).thenReturn(42); when(requestMock.repeat()).thenReturn(true); RepeaterActor actor = new RepeaterActor(); actor.handle(requestMock); verify(sequenceMock).getCurrentLevel(); verify(sequenceMock).goTo(42, 0); verifyNoMoreInteractions(sequenceMock); }
@Test public void Should_repeaterNotRepeatChainWhenNotRequired() throws Exception { when(requestMock.repeat()).thenReturn(false); RepeaterActor actor = new RepeaterActor(); actor.handle(requestMock); verifyNoMoreInteractions(sequenceMock); }