@Test public void should_find_last_build_number() throws Exception { when(hudson.getLastBuildNumber("project1")).thenReturn(5); SoftwareProjectId projectId = new SoftwareProjectId("project1"); String lastBuildId = hudsonConnection.getLastBuildId(projectId); assertEquals("5", lastBuildId); }
@Override public String getLastBuildId(SoftwareProjectId projectId) throws ProjectNotFoundException, BuildIdNotFoundException { checkConnected(); checkSoftwareProjectId(projectId); try { String projectName = jobName(projectId); return String.valueOf(hudson.getLastBuildNumber(projectName)); } catch (HudsonJobNotFoundException e) { throw new ProjectNotFoundException(e); } catch (HudsonBuildNotFoundException e) { throw new BuildIdNotFoundException(e); } }
HudsonConnection implements BuildCapability, ViewCapability, TestCapability { @Override public String getLastBuildId(SoftwareProjectId projectId) throws ProjectNotFoundException, BuildIdNotFoundException { checkConnected(); checkSoftwareProjectId(projectId); try { String projectName = jobName(projectId); return String.valueOf(hudson.getLastBuildNumber(projectName)); } catch (HudsonJobNotFoundException e) { throw new ProjectNotFoundException(e); } catch (HudsonBuildNotFoundException e) { throw new BuildIdNotFoundException(e); } } }
HudsonConnection implements BuildCapability, ViewCapability, TestCapability { @Override public String getLastBuildId(SoftwareProjectId projectId) throws ProjectNotFoundException, BuildIdNotFoundException { checkConnected(); checkSoftwareProjectId(projectId); try { String projectName = jobName(projectId); return String.valueOf(hudson.getLastBuildNumber(projectName)); } catch (HudsonJobNotFoundException e) { throw new ProjectNotFoundException(e); } catch (HudsonBuildNotFoundException e) { throw new BuildIdNotFoundException(e); } }  }
HudsonConnection implements BuildCapability, ViewCapability, TestCapability { @Override public String getLastBuildId(SoftwareProjectId projectId) throws ProjectNotFoundException, BuildIdNotFoundException { checkConnected(); checkSoftwareProjectId(projectId); try { String projectName = jobName(projectId); return String.valueOf(hudson.getLastBuildNumber(projectName)); } catch (HudsonJobNotFoundException e) { throw new ProjectNotFoundException(e); } catch (HudsonBuildNotFoundException e) { throw new BuildIdNotFoundException(e); } }  @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); }
HudsonConnection implements BuildCapability, ViewCapability, TestCapability { @Override public String getLastBuildId(SoftwareProjectId projectId) throws ProjectNotFoundException, BuildIdNotFoundException { checkConnected(); checkSoftwareProjectId(projectId); try { String projectName = jobName(projectId); return String.valueOf(hudson.getLastBuildNumber(projectName)); } catch (HudsonJobNotFoundException e) { throw new ProjectNotFoundException(e); } catch (HudsonBuildNotFoundException e) { throw new BuildIdNotFoundException(e); } }  @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);  }