@Test public void testOnAppLauncherRemoveEvent() { final String appName = "appName"; presenter.onAppLauncherAddEvent(new AppLauncherAddEvent(appName, null, null)); presenter.onAppLauncherRemoveEvent(new AppLauncherRemoveEvent(appName)); verify(view).removeAllAppLauncher(); verify(updatedEvent, times(2)).fire(any(AppLauncherUpdatedEvent.class)); assertTrue(presenter.isAppLauncherEmpty()); }
public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); } }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); }  }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); }  IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty(); }
AppLauncherPresenter { public void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event) { appLauncherAddEvents.stream().filter(e -> e.getAppName().equals(event.getAppName())).findFirst().ifPresent(e -> appLauncherAddEvents.remove(e)); view.removeAllAppLauncher(); appLauncherAddEvents.stream().forEach(e -> view.addAppLauncher(e.getAppName(), e.getUrl(), e.getIconClass())); updatedEvent.fire(new AppLauncherUpdatedEvent()); }  IsWidget getView(); void onAppLauncherRemoveEvent(@Observes final AppLauncherRemoveEvent event); void onAppLauncherAddEvent(@Observes final AppLauncherAddEvent event); boolean isAppLauncherEmpty();  }