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