TeamCityConnection implements BuildCapability, TestCapability, ViewCapability { @Override public void connect(String url, String login, String password) { checkNotNull(url, "url is mandatory"); if (isBlank(url)) { throw new IllegalArgumentException("url can't be null."); } if (isBlank(login)) { LOG.info("Login is blank, new value is 'guest'"); login = "guest"; password = ""; } teamCity = new TeamCity(url, login, password); connected = true; }  @Override void connect(String url, String login, String password); @Override void close(); @Override String getDescription(SoftwareProjectId softwareProjectId); @Override SoftwareProjectId identify(ProjectKey projectKey); @Override List<String> getBuildIds(SoftwareProjectId softwareProjectId); @Override Map<SoftwareProjectId, String> listSoftwareProjectIds(); @Override BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId); @Override Date getEstimatedFinishTime(SoftwareProjectId softwareProjectId, String buildId); @Override boolean isBuilding(SoftwareProjectId softwareProjectId, String buildId); @Override String getLastBuildId(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); @Override List<SoftwareProjectId> findSoftwareProjectIdsByViews(List<String> views); @Override List<String> findViews(); @Override List<String> findProjectNamesByView(String viewName);  }
@Test(expected = NullPointerException.class) public void should_fail_when_passing_null() { teamCityConnection.connect(null, "", ""); }
@Test(expected = IllegalArgumentException.class) public void should_fail_when_passing_empty_string() { teamCityConnection.connect("", "", ""); }