DataSetExplorer implements IsWidget { void onDataSetDefRegisteredEvent(@Observes DataSetDefRegisteredEvent event) { checkNotNull("event", event); final DataSetDef def = event.getDataSetDef(); if (def != null && def.isPublic() && isSupported(def)) { show(); } } @Inject  DataSetExplorer(final Instance<DataSetPanel> panelInstances,
                           final DataSetClientServices clientServices,
                           final View view); @PostConstruct void init(); @Override Widget asWidget(); void show();  }
@Test public void testOnDataSetDefRegisteredEvent() { final DataSetDefRegisteredEvent event = mock(DataSetDefRegisteredEvent.class); when(event.getDataSetDef()).thenReturn(dataSetDef); presenter.onDataSetDefRegisteredEvent(event); assertEquals(1, presenter.panels.size()); assertEquals(dataSetPanel, presenter.panels.get(0)); verify(view).clear(); verify(view).addPanel(any(DataSetPanel.View.class)); verify(dataSetPanel).show(dataSetDef, "dataSetsExplorerPanelGroup"); }