TeamCityConnection implements BuildCapability, TestCapability, ViewCapability { @Override public String getDescription(SoftwareProjectId softwareProjectId) throws ProjectNotFoundException { checkConnected(); checkSoftwareProjectId(softwareProjectId); try { String buildTypeId = softwareProjectId.getProjectId(); TeamCityBuildType buildType = teamCity.findBuildType(buildTypeId); return buildType.getDescription(); } catch (TeamCityBuildTypeNotFoundException e) { throw new ProjectNotFoundException("Cannot find description of project with software project id:" + softwareProjectId, e); } }  @Override void connect(String url, String login, String password); @Override void close(); @Override String getDescription(SoftwareProjectId softwareProjectId); @Override SoftwareProjectId identify(ProjectKey projectKey); @Override List<String> getBuildIds(SoftwareProjectId softwareProjectId); @Override Map<SoftwareProjectId, String> listSoftwareProjectIds(); @Override BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId); @Override Date getEstimatedFinishTime(SoftwareProjectId softwareProjectId, String buildId); @Override boolean isBuilding(SoftwareProjectId softwareProjectId, String buildId); @Override String getLastBuildId(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); @Override List<SoftwareProjectId> findSoftwareProjectIdsByViews(List<String> views); @Override List<String> findViews(); @Override List<String> findProjectNamesByView(String viewName);  }
@Test public void should_get_description() throws Exception { TeamCityBuildType buildType = new TeamCityBuildType(); buildType.setDescription("description"); when(teamCity.findBuildType(anyString())).thenReturn(buildType); SoftwareProjectId softwareProjectId = new SoftwareProjectId("projectId"); String description = teamCityConnection.getDescription(softwareProjectId); assertEquals("description", description); }