HudsonConnection implements BuildCapability, ViewCapability, TestCapability { @Override public List<String> findViews() { checkConnected(); List<String> views = hudson.findViews(); views.removeAll(DEFAULT_VIEWS); return views; }  @Override void connect(String url, String login, String password); @Override Map<SoftwareProjectId, String> listSoftwareProjectIds(); @Override Date getEstimatedFinishTime(SoftwareProjectId projectId, String buildId); @Override boolean isBuilding(SoftwareProjectId projectId, String buildId); @Override BuildState getBuildState(SoftwareProjectId projectId, String buildId); @Override String getLastBuildId(SoftwareProjectId projectId); @Override List<String> findViews(); @Override List<String> findProjectNamesByView(String viewName); @Override List<SoftwareProjectId> findSoftwareProjectIdsByViews(List<String> views); @Override void close(); @Override String getDescription(SoftwareProjectId projectId); @Override SoftwareProjectId identify(ProjectKey projectKey); @Override List<String> getBuildIds(SoftwareProjectId softwareProjectId); @Override String getMavenId(SoftwareProjectId softwareProjectId); @Override String getName(SoftwareProjectId softwareProjectId); @Override boolean isClosed(); @Override BuildTime getBuildTime(SoftwareProjectId softwareProjectId, String buildId); @Override boolean isProjectDisabled(SoftwareProjectId softwareProjectId); @Override List<Commiter> getBuildCommiters(SoftwareProjectId softwareProjectId, String buildId); @Override TestResult analyzeUnitTests(SoftwareProjectId softwareProjectId); @Override TestResult analyzeIntegrationTests(SoftwareProjectId softwareProjectId);  }
@Test public void should_remove_default_view() { List<String> viewNames = asList("Alle", "Todo", "Tous", "\u3059\u3079\u3066", "Tudo", "\u0412\u0441\u0435", "Hepsi", "All"); List<String> defaultViews = new ArrayList<String>(viewNames); when(hudson.findViews()).thenReturn(defaultViews); List<String> views = hudsonConnection.findViews(); assertTrue(views.isEmpty()); }
@Test public void should_keep_custom_view() { List<String> defaultViews = new ArrayList<String>(asList("Tous", "MyCusomView")); when(hudson.findViews()).thenReturn(defaultViews); List<String> views = hudsonConnection.findViews(); assertEquals(1, views.size()); }