SchedulerActor { public void listEntries(final ListEntriesQueryMessage message) throws ChangeValueException, EntryStorageAccessException { message.setEntries( service.getEntryStorage().listLocalEntries().stream() .map(ISchedulerEntry::getState) .collect(Collectors.toList())); } SchedulerActor(final IObject args); void addEntry(final AddEntryQueryMessage message); void addEntryWithSettingId(final SetEntryIdMessage message); void addEntryList(final AddEntryQueryListMessage message); void listEntries(final ListEntriesQueryMessage message); void deleteEntry(final DeleteEntryQueryMessage message); void start(final StartStopMessage message); void stop(final StartStopMessage message); void configure(final ConfigureQueryMessage message);  }
@Test public void Should_listEntries() throws Exception { when(storage.listLocalEntries()).thenReturn(Collections.singletonList(entryMock)); ArgumentCaptor<List> captor = ArgumentCaptor.forClass(List.class); SchedulerActor actor = new SchedulerActor(args); actor.listEntries(listEntriesQueryMessage); verify(listEntriesQueryMessage, times(1)).setEntries(captor.capture()); assertEquals(1, captor.getValue().size()); assertSame(entryMock.getState(), captor.getValue().get(0)); }