HudsonConnection implements BuildCapability, ViewCapability, TestCapability { @Override public void connect(String url, String login, String password) { checkNotNull(url, "url is mandatory"); if (isBlank(url)) { throw new IllegalStateException("url can't be null."); } if (StringUtils.isBlank(login)) { hudson = new Hudson(url); } else { hudson = new Hudson(url, login, password); } connected = true; }  @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);  }
@Test(expected = IllegalStateException.class) public void should_throw_exception_if_no_url() { new HudsonConnection().connect("", "", ""); }
@Test public void should_create_hudson() { new HudsonConnection().connect("url", "", ""); }