class TeamCityConnection implements BuildCapability, TestCapability, ViewCapability {

    @Override
    public boolean isBuilding(SoftwareProjectId softwareProjectId, String buildId) throws ProjectNotFoundException,
            BuildNotFoundException {
        checkConnected();
        checkSoftwareProjectId(softwareProjectId);
        checkBuildId(buildId);
        try {
            TeamCityBuild build = teamCity.findRunningBuild();
            return softwareProjectId.getProjectId().equals(build.getBuildType().getId())
                    && buildId.equals(build.getId());
        } catch (TeamCityBuildNotFoundException e) {
            return false;
        }
    }

}