OfframpServiceV2 implements OfframpService { @Override public void onEvent(String event) { events.offer(encoder.decode(event)); }  @Override void run(); @Override void close(); @Override void onEvent(String event);  }
@Test public void onEvent_testWithString() throws Exception { Event event = new Cancel(); String raw = mapper.writeValueAsString(event); doReturn(event).when(encoder).decode(raw); underTest.onEvent(raw); assertThat(underTest.getEvents().peek(), is(event)); }