HudsonFinder { List<String> findViews() { List<String> views = new ArrayList<String>(); try { String projectsUrl = hudsonUrlBuilder.getAllProjectsUrl(); Hudson hudson = client.resource(projectsUrl, Hudson.class); for (View view : hudson.getViews()) { views.add(view.getName()); } } catch (ResourceNotFoundException e) { if (LOG.isDebugEnabled()) { LOG.debug(e.getMessage(), e); } } return views; } HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder);  HudsonFinder(HudsonUrlBuilder hudsonUrlBuilder, String login, String password); HudsonTestResult findUnitTestResult(String jobName, int buildNumber); HudsonTestResult findIntegrationTestResult(String jobName, int buildNumber);  }
@Test public void should_return_all_views() throws ResourceNotFoundException { Hudson viewsResource = (Hudson) load("hudson/views.xml", Hudson.class); when(client.resource(anyString(), any(Class.class))).thenReturn(viewsResource); List<String> views = hudsonFinder.findViews(); assertEquals(5, views.size()); List<String> expectedViews = Arrays.asList("android", "on", "on-tools", "synthesis", "All"); for (String expectedView : expectedViews) { assertTrue(views.contains(expectedView)); } }