WebSocketUtilImpl implements WebSocketUtil { @Override public void subscribeHandler(@NotNull String channel, @NotNull SubscriptionHandler handler) { try { messageBus.subscribe(channel, handler); } catch (WebSocketException e) { Log.error(getClass(), e); } } @Inject  WebSocketUtilImpl(MessageBus messageBus); @Override void subscribeHandler(@NotNull String channel, @NotNull SubscriptionHandler handler); @Override void unSubscribeHandler(@NotNull String channel, @NotNull SubscriptionHandler handler);  }
@Test public void handlerShouldBeSubscribed() throws Exception { util.subscribeHandler(SOME_TEXT, handler); verify(messageBus).subscribe(SOME_TEXT, handler); }