### Question:
Events { public <T> void subscribe(Object token, Consumer<T> consumer) { Set<Consumer<?>> set = subscriptions.get(token); if (set == null) { set = new LinkedHashSet<>(); subscriptions.put(token, set); } set.add(consumer); }  void subscribe(Object token, Consumer<T> consumer); void unsubscribe(Object topic); void unsubscribe(Object topic, Consumer<T> consumer); void publish(Object topic, T payload); @SuppressWarnings({ "unchecked", "rawtypes" }) void tick();  }### Answer:
@Test public void testSubscribe() { Consumer<String> consumer = stringConsumerMock(); events.subscribe(TOKEN, consumer); events.publish(TOKEN, "hello"); events.tick(); Mockito.verify(consumer) .accept("hello"); }