HudsonFinder { Set<HudsonCommiter> findCommiters(String[] commiterNames) { Set<HudsonCommiter> commiters = new TreeSet<HudsonCommiter>(); for (String commiterName : commiterNames) { try { String url = hudsonUrlBuilder.getUserUrl(commiterName); HudsonUser hudsonUser = client.resource(url, HudsonUser.class); HudsonCommiter commiter = new HudsonCommiter(hudsonUser.getId()); commiter.setName(commiterName); commiter.setEmail(hudsonUser.getEmail()); commiters.add(commiter); } catch (ResourceNotFoundException e) { if (LOG.isDebugEnabled()) { LOG.debug("Can't find user " + commiterName, e); } } } return commiters; } 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 testFindCommiters() throws ResourceNotFoundException { HudsonUser user = new HudsonUser(); user.setId("jsmadja"); user.setName("Julien Smadja"); user.setEmail("jsmadja@xebia.fr"); when(client.resource(anyString(), any(Class.class))).thenReturn(user); Set<HudsonCommiter> commiters = hudsonFinder.findCommiters(new String[] { "Julien Smadja" }); HudsonCommiter commiter = commiters.iterator().next(); assertEquals("jsmadja", commiter.getId()); assertEquals("Julien Smadja", commiter.getName()); assertEquals("jsmadja@xebia.fr", commiter.getEmail()); }