### Question:
ProvisioningManagementBrowserPresenter { protected void onProviderTypeSelected(@Observes final ProviderTypeSelectedEvent event) { if (event.getProviderTypeKey() != null) { selectProviderType(event.getProviderTypeKey(), event.getProviderId()); } } @Inject  ProvisioningManagementBrowserPresenter(final ProvisioningManagementBrowserPresenter.View view,
                                                  final ProviderTypeNavigationPresenter providerTypeNavigationPresenter,
                                                  final ProviderTypePresenter providerTypePresenter,
                                                  final ProviderTypeEmptyPresenter providerTypeEmptyPresenter,
                                                  final ProviderEmptyPresenter providerEmptyPresenter,
                                                  final ProviderPresenter providerPresenter,
                                                  final Caller<ProviderTypeService> providerTypeService,
                                                  final Caller<ProvisioningScreensService> provisioningScreensService,
                                                  final Event<ProviderTypeSelectedEvent> providerTypeSelectedEvent); @PostConstruct void init(); @OnOpen void onOpen(); @WorkbenchPartTitle String getTitle(); @WorkbenchPartView IsElement getView(); static final String IDENTIFIER; }### Answer:
@Test public void testOnProviderTypeSelectedWithProviders() { ProviderType selectedProviderType = providerTypes.iterator().next(); ProviderTypeKey selectedProviderTypeKey = selectedProviderType.getKey(); List<ProviderKey> providerKeys = mockProviderKeyList(selectedProviderType.getKey(), PROVIDER_TYPES_SIZE); ProviderKey selectedProviderKey = providerKeys.iterator().next(); ProvidersInfo providersInfo = mock(ProvidersInfo.class); when(providersInfo.getProviderType()).thenReturn(selectedProviderType); when(providersInfo.getProvidersKey()).thenReturn(providerKeys); when(providerTypeService.getProviderType(selectedProviderTypeKey)).thenReturn(selectedProviderType); when(provisioningScreensService.getProvidersInfo(selectedProviderTypeKey)).thenReturn(providersInfo); presenter.onProviderTypeSelected(new ProviderTypeSelectedEvent(selectedProviderType.getKey(), selectedProviderKey.getId())); verify(providerTypePresenter, times(1)).setup(selectedProviderType, providerKeys, selectedProviderKey); }
@Test public void testOnProviderTypeSelectedWithNOProviders() { ProviderType selectedProviderType = providerTypes.iterator().next(); ProviderTypeKey selectedProviderTypeKey = selectedProviderType.getKey(); List<ProviderKey> providerKeys = new ArrayList<>(); ProvidersInfo providersInfo = mock(ProvidersInfo.class); when(providersInfo.getProviderType()).thenReturn(selectedProviderType); when(providersInfo.getProvidersKey()).thenReturn(providerKeys); when(providerTypeService.getProviderType(selectedProviderTypeKey)).thenReturn(selectedProviderType); when(provisioningScreensService.getProvidersInfo(selectedProviderTypeKey)).thenReturn(providersInfo); presenter.onProviderTypeSelected(new ProviderTypeSelectedEvent(selectedProviderType.getKey())); verify(providerEmptyPresenter, times(1)).setProviderType(selectedProviderType); verify(view, times(1)).setContent(providerEmptyPresenterView); verify(providerTypePresenter, times(1)).setup(any(ProviderType.class), anyCollectionOf(ProviderKey.class), any(ProviderKey.class)); }