class TeamCityConnection implements BuildCapability, TestCapability, ViewCapability {

    @Override
    public String getName(SoftwareProjectId softwareProjectId) throws ProjectNotFoundException {
        checkConnected();
        checkSoftwareProjectId(softwareProjectId);
        try {
            String buildTypeId = softwareProjectId.getProjectId();
            TeamCityBuildType buildType = teamCity.findBuildType(buildTypeId);
            return buildType.getName();
        } catch (TeamCityBuildTypeNotFoundException e) {
            throw new ProjectNotFoundException("Can't find name of project with software project id:"
                    + softwareProjectId, e);
        }
    }

}