CommonViewsProvider implements AppSettingsProvider<ViewSettings> { @Override public List<ViewSettings> getSettings() { List<ViewSettings> settings = new ArrayList<>(5); if (security.isTDPUser()) { settings.add(HomeViews.appHeaderBar()); settings.add(HomeViews.sidePanel()); settings.add(HomeViews.breadcrumb()); settings.add(PlaygroundViews.playgroundAppHeaderBar()); } else { settings.add(HomeViewsForNonTDPUsers.appHeaderBarForNonTdpUsers()); settings.add(HomeViewsForNonTDPUsers.sidePanel()); } settings.addAll(asList(ListViews.folderList(), ListViews.preparationList())); return settings; }  @Override List<ViewSettings> getSettings();  }
@Test public void shouldGetProviderForTDPUsers() { Mockito.when(security.isTDPUser()).thenReturn(true); final List<ViewSettings> settings = provider.getSettings(); assertNotNull(settings); assertEquals(settings.size(), 6); assertTrue(settings.contains(HomeViews.appHeaderBar())); assertTrue(settings.contains(HomeViews.sidePanel())); assertTrue(settings.contains(HomeViews.breadcrumb())); assertTrue(settings.contains(ListViews.folderList())); assertTrue(settings.contains(ListViews.preparationList())); assertTrue(settings.contains(PlaygroundViews.playgroundAppHeaderBar())); }
@Test public void shouldGetProviderForNonTDPUsers() { Mockito.when(security.isTDPUser()).thenReturn(false); final List<ViewSettings> settings = provider.getSettings(); assertNotNull(settings); assertEquals(4, settings.size()); assertTrue(settings.contains(HomeViewsForNonTDPUsers.appHeaderBarForNonTdpUsers())); assertTrue(settings.contains(HomeViewsForNonTDPUsers.sidePanel())); assertTrue(settings.contains(ListViews.folderList())); assertTrue(settings.contains(ListViews.preparationList())); }