@Test public void testSetup() { presenter.setup(providerType, providers, provider); verify(view, times(1)).clear(); verify(view, times(1)).setProviderTypeName(getDisplayableProviderTypeName(providerType)); providers.forEach(providerKey -> verify(view, times(1)).addProvider(eq(provider.getId()), eq(provider.getId()), any(Command.class))); verify(providerSelectedEvent, times(1)).fire(new ProviderSelectedEvent(provider)); }
public void setup(final ProviderType providerType, final Collection<ProviderKey> providers, final ProviderKey firstProviderKey) { view.clear(); this.providerType = providerType; view.setProviderTypeName(getDisplayableProviderTypeName(providerType)); if (firstProviderKey != null) { addProvider(firstProviderKey); providers.stream() .filter(providerKey -> !providerKey.equals(firstProviderKey)) .forEach(this::addProvider); selectProvider(firstProviderKey); } }
ProviderTypePresenter { public void setup(final ProviderType providerType, final Collection<ProviderKey> providers, final ProviderKey firstProviderKey) { view.clear(); this.providerType = providerType; view.setProviderTypeName(getDisplayableProviderTypeName(providerType)); if (firstProviderKey != null) { addProvider(firstProviderKey); providers.stream() .filter(providerKey -> !providerKey.equals(firstProviderKey)) .forEach(this::addProvider); selectProvider(firstProviderKey); } } }
ProviderTypePresenter { public void setup(final ProviderType providerType, final Collection<ProviderKey> providers, final ProviderKey firstProviderKey) { view.clear(); this.providerType = providerType; view.setProviderTypeName(getDisplayableProviderTypeName(providerType)); if (firstProviderKey != null) { addProvider(firstProviderKey); providers.stream() .filter(providerKey -> !providerKey.equals(firstProviderKey)) .forEach(this::addProvider); selectProvider(firstProviderKey); } } @Inject  ProviderTypePresenter(final View view,
                                 final Caller<ProviderTypeService> providerTypeService,
                                 final Event<AddNewProviderEvent> addNewProviderEvent,
                                 final Event<ProviderTypeListRefreshEvent> providerTypeListRefreshEvent,
                                 final Event<ProviderSelectedEvent> providerSelectedEvent); }
ProviderTypePresenter { public void setup(final ProviderType providerType, final Collection<ProviderKey> providers, final ProviderKey firstProviderKey) { view.clear(); this.providerType = providerType; view.setProviderTypeName(getDisplayableProviderTypeName(providerType)); if (firstProviderKey != null) { addProvider(firstProviderKey); providers.stream() .filter(providerKey -> !providerKey.equals(firstProviderKey)) .forEach(this::addProvider); selectProvider(firstProviderKey); } } @Inject  ProviderTypePresenter(final View view,
                                 final Caller<ProviderTypeService> providerTypeService,
                                 final Event<AddNewProviderEvent> addNewProviderEvent,
                                 final Event<ProviderTypeListRefreshEvent> providerTypeListRefreshEvent,
                                 final Event<ProviderSelectedEvent> providerSelectedEvent); @PostConstruct void init(); View getView(); void setup(final ProviderType providerType,
                      final Collection<ProviderKey> providers,
                      final ProviderKey firstProviderKey); void onProviderSelect(@Observes final ProviderSelectedEvent event); void onAddNewProvider(); void onRemoveProviderType(); }
ProviderTypePresenter { public void setup(final ProviderType providerType, final Collection<ProviderKey> providers, final ProviderKey firstProviderKey) { view.clear(); this.providerType = providerType; view.setProviderTypeName(getDisplayableProviderTypeName(providerType)); if (firstProviderKey != null) { addProvider(firstProviderKey); providers.stream() .filter(providerKey -> !providerKey.equals(firstProviderKey)) .forEach(this::addProvider); selectProvider(firstProviderKey); } } @Inject  ProviderTypePresenter(final View view,
                                 final Caller<ProviderTypeService> providerTypeService,
                                 final Event<AddNewProviderEvent> addNewProviderEvent,
                                 final Event<ProviderTypeListRefreshEvent> providerTypeListRefreshEvent,
                                 final Event<ProviderSelectedEvent> providerSelectedEvent); @PostConstruct void init(); View getView(); void setup(final ProviderType providerType,
                      final Collection<ProviderKey> providers,
                      final ProviderKey firstProviderKey); void onProviderSelect(@Observes final ProviderSelectedEvent event); void onAddNewProvider(); void onRemoveProviderType();  }