JsWorkbenchScreenActivity extends AbstractWorkbenchScreenActivity implements JsWorkbenchLazyActivity { Void registerSubscription(final Object callback, final String eventFqcn, final Object obj) { subscriptions.add(getSubscription(callback, eventFqcn)); subscribeOnErraiBus(eventFqcn); return null; } JsWorkbenchScreenActivity(final JsNativeScreen screen,
                                     final PlaceManager placeManager); @Override void updateRealContent(final JavaScriptObject jsObject); @Override void onStartup(final PlaceRequest place); boolean isScreenLoaded(); @Override void onOpen(); @Override void onClose(); @Override boolean onMayClose(); @Override void onShutdown(); @Override void onFocus(); @Override void onLostFocus(); @Override String getTitle(); @Override Position getDefaultPosition(); @Override PlaceRequest getPlace(); @Override String getIdentifier(); @Override IsWidget getTitleDecoration(); @Override void getMenus(final Consumer<Menus> consumer); @Override ToolBar getToolBar(); @Override PlaceRequest getOwningPlace(); @Override IsWidget getWidget(); @Override String contextId(); @Override int preferredHeight(); @Override int preferredWidth(); native void callWithParsedJsonObject(final Object func, final String jsonArg);  }
@Test public void registerSubscription() { final Object callback = mock(Object.class); final String eventFqcn = "foo"; doReturn(mock(Subscription.class)).when(jsWorkbenchScreenActivity).getSubscription(callback, eventFqcn); doNothing().when(jsWorkbenchScreenActivity).subscribeOnErraiBus(eventFqcn); final Void nullReturn = jsWorkbenchScreenActivity.registerSubscription(callback, eventFqcn, null); assertNull(nullReturn); assertEquals(1, jsWorkbenchScreenActivity.subscriptions.size()); verify(jsWorkbenchScreenActivity).subscribeOnErraiBus(eventFqcn); }