### Question:
CounterQueryActor extends Actor implements CounterQuery, Scheduled<Object> { @Override public Completes<Integer> counter() { return completes().with(currentCount.orElse(-1)); } @SuppressWarnings("unchecked")  CounterQueryActor(JournalReader<TextEntry> streamReader, EntryAdapterProvider entryAdapterProvider); @Override Completes<Integer> counter(); @Override @SuppressWarnings("rawtypes") void intervalSignal(Scheduled<Object> scheduled, Object data); @Override void stop();  }### Answer:
@Test public void testThatUpdatesTheCounterFromIncreaseEventFromStream() { buildWithEvent(counterIncreasedAdapter.toEntry(new CounterIncreased(CURRENT_COUNTER))); verify(journalReader, timeout(TIMEOUT).atLeastOnce()).readNext(); int counter = query.counter().await(); assertEquals(CURRENT_COUNTER, counter); }
@Test public void testThatUpdatesTheCounterFromDecreaseEventFromStream() { buildWithEvent(counterDecreasedAdapter.toEntry(new CounterDecreased(CURRENT_COUNTER))); verify(journalReader, timeout(TIMEOUT).atLeastOnce()).readNext(); int result = query.counter().await(); assertEquals(CURRENT_COUNTER, result); }