@Test public void should_return_all_projects_of_a_view() throws Exception { ListView viewResource = (ListView) load("hudson/view.xml", ListView.class); when(client.resource(anyString(), any(Class.class))).thenReturn(viewResource); List<String> projectNames = hudsonFinder.findJobNamesByView("android"); assertEquals(4, projectNames.size()); List<String> expectedProjects = Arrays.asList("android-1.11", "android-1.11-daily", "android-trunk", "android-trunk-daily"); for (String expectedProject : expectedProjects) { assertTrue(projectNames.contains(expectedProject)); } }
List<String> findJobNamesByView(String viewName) throws HudsonViewNotFoundException { try { List<String> jobNames = new ArrayList<String>(); String viewUrl = hudsonUrlBuilder.getViewUrl(viewName); ListView view = client.resource(viewUrl, ListView.class); for (Job job : view.getJobs()) { jobNames.add(job.getName()); } return jobNames; } catch (ResourceNotFoundException e) { throw new HudsonViewNotFoundException(e.getMessage(), e); } }
HudsonFinder { List<String> findJobNamesByView(String viewName) throws HudsonViewNotFoundException { try { List<String> jobNames = new ArrayList<String>(); String viewUrl = hudsonUrlBuilder.getViewUrl(viewName); ListView view = client.resource(viewUrl, ListView.class); for (Job job : view.getJobs()) { jobNames.add(job.getName()); } return jobNames; } catch (ResourceNotFoundException e) { throw new HudsonViewNotFoundException(e.getMessage(), e); } } }
HudsonFinder { List<String> findJobNamesByView(String viewName) throws HudsonViewNotFoundException { try { List<String> jobNames = new ArrayList<String>(); String viewUrl = hudsonUrlBuilder.getViewUrl(viewName); ListView view = client.resource(viewUrl, ListView.class); for (Job job : view.getJobs()) { jobNames.add(job.getName()); } return jobNames; } catch (ResourceNotFoundException e) { throw new HudsonViewNotFoundException(e.getMessage(), e); } } HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder);  HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder, String login, String password); }
HudsonFinder { List<String> findJobNamesByView(String viewName) throws HudsonViewNotFoundException { try { List<String> jobNames = new ArrayList<String>(); String viewUrl = hudsonUrlBuilder.getViewUrl(viewName); ListView view = client.resource(viewUrl, ListView.class); for (Job job : view.getJobs()) { jobNames.add(job.getName()); } return jobNames; } catch (ResourceNotFoundException e) { throw new HudsonViewNotFoundException(e.getMessage(), e); } } HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder);  HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder, String login, String password); HudsonTestResult findUnitTestResult(String jobName, int buildNumber); HudsonTestResult findIntegrationTestResult(String jobName, int buildNumber); }
HudsonFinder { List<String> findJobNamesByView(String viewName) throws HudsonViewNotFoundException { try { List<String> jobNames = new ArrayList<String>(); String viewUrl = hudsonUrlBuilder.getViewUrl(viewName); ListView view = client.resource(viewUrl, ListView.class); for (Job job : view.getJobs()) { jobNames.add(job.getName()); } return jobNames; } catch (ResourceNotFoundException e) { throw new HudsonViewNotFoundException(e.getMessage(), e); } } HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder);  HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder, String login, String password); HudsonTestResult findUnitTestResult(String jobName, int buildNumber); HudsonTestResult findIntegrationTestResult(String jobName, int buildNumber);  }