DataSetExplorer implements IsWidget { @PostConstruct public void init() { if (!dataSetEditorPlugin.isUnsatisfied()) { List<DataSetProviderType> allTypes = new ArrayList<DataSetProviderType>(SUPPORTED_TYPES); for (DataSetEditorPlugin plugin : dataSetEditorPlugin) { allTypes.add(plugin.getProviderType()); } SUPPORTED_TYPES = allTypes; } view.init(this); } @Inject  DataSetExplorer(final Instance<DataSetPanel> panelInstances,
                           final DataSetClientServices clientServices,
                           final View view,
                           final ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin); @PostConstruct void init(); @Override Widget asWidget(); void show();  }
@Test public void testInit() throws Exception { presenter.init(); verify(view, times(1)).init(presenter); }
@Test public void testInitWithEditorPlugin() throws Exception { when(pluginEditor.getProviderType()).thenReturn(new CustomDataSetProviderType()); when(pluginEditor.getTypeSelectorTitle()).thenReturn("Custom"); when(pluginEditor.getTypeSelectorImageUri()).thenReturn(Mockito.mock(SafeUri.class)); when(dataSetEditorPlugin.isUnsatisfied()).thenReturn(false); when(dataSetEditorPlugin.iterator()).thenReturn(Arrays.asList(pluginEditor).iterator(), Arrays.asList(pluginEditor).iterator()); when(dataSetDef.getProvider()).thenReturn(new CustomDataSetProviderType()); presenter.init(); verify(view, times(1)).init(presenter); verify(dataSetEditorPlugin, times(1)).isUnsatisfied(); verify(dataSetEditorPlugin, times(1)).iterator(); assertEquals(5, presenter.SUPPORTED_TYPES.size()); }