ActivityBeansCache { public List<SyncBeanDef<Activity>> getPerspectiveActivities() { List<SyncBeanDef<Activity>> results = new ArrayList<>(); for (SyncBeanDef<Activity> beanDef : activitiesById.values()) { if (beanDef.isAssignableTo(PerspectiveActivity.class)) { results.add(beanDef); } } return results; } ActivityBeansCache(); @Inject  ActivityBeansCache(SyncBeanManager iocManager,
                              Event<NewPerspectiveEvent> newPerspectiveEventEvent,
                              Event<NewWorkbenchScreenEvent> newWorkbenchScreenEventEvent,
                              ResourceTypeManagerCache resourceTypeManagerCache,
                              ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager,
                              GWTEditorNativeRegister gwtEditorNativeRegister); void removeActivity(String id); void addNewScreenActivity(final SyncBeanDef<Activity> activityBean); void addNewPerspectiveActivity(final SyncBeanDef<Activity> activityBean); void addNewEditorActivity(final SyncBeanDef<Activity> activityBean,
                                     String priority,
                                     String resourceTypeName); void addNewEditorActivity(final SyncBeanDef<Activity> syncBeanDef,
                                     final int priority,
                                     final List<String> resourceTypes); void addNewSplashScreenActivity(final SyncBeanDef<Activity> activityBean); boolean hasActivity(String id); List<SplashScreenActivity> getSplashScreens(); SyncBeanDef<Activity> getActivity(final String id); SyncBeanDef<Activity> getActivity(final Path path); List<SyncBeanDef<Activity>> getPerspectiveActivities(); List<String> getActivitiesById(); void noOp();  }
@Test public void getPerspectiveActivities() { SyncBeanDef mock1 = mock(SyncBeanDef.class); when(mock1.getName()).thenReturn("perspective2"); when(mock1.isAssignableTo(PerspectiveActivity.class)).thenReturn(true); SyncBeanDef mock2 = mock(SyncBeanDef.class); when(mock2.getName()).thenReturn("screen"); when(mock2.isAssignableTo(PerspectiveActivity.class)).thenReturn(false); cache.addNewPerspectiveActivity(mock1); cache.addNewPerspectiveActivity(mock2); List<SyncBeanDef<Activity>> perspectiveActivities = cache.getPerspectiveActivities(); assertEquals(perspectiveActivities.size(), 1); }