@Test(expected = SonarMeasureNotFoundException.class) public void should_throw_exception_when_sonar_connection_fails() throws SonarMeasureNotFoundException { when(sonar.find(Mockito.any(ResourceQuery.class))).thenThrow(new ConnectionException()); sonarClient.findMeasure("artifactId", "measureKey"); }
public Measure findMeasure(String artifactId, String measureKey) throws SonarMeasureNotFoundException { Preconditions.checkArgument(!Strings.isNullOrEmpty(artifactId), "artifactId is a mandatory parameter"); Preconditions.checkNotNull(measureKey, "measureKey is a mandatory parameter"); return findMeasureFromSonar(artifactId, measureKey); }
Sonar { public Measure findMeasure(String artifactId, String measureKey) throws SonarMeasureNotFoundException { Preconditions.checkArgument(!Strings.isNullOrEmpty(artifactId), "artifactId is a mandatory parameter"); Preconditions.checkNotNull(measureKey, "measureKey is a mandatory parameter"); return findMeasureFromSonar(artifactId, measureKey); } }
Sonar { public Measure findMeasure(String artifactId, String measureKey) throws SonarMeasureNotFoundException { Preconditions.checkArgument(!Strings.isNullOrEmpty(artifactId), "artifactId is a mandatory parameter"); Preconditions.checkNotNull(measureKey, "measureKey is a mandatory parameter"); return findMeasureFromSonar(artifactId, measureKey); } Sonar(String url);  Sonar(String url, String login, String password); }
Sonar { public Measure findMeasure(String artifactId, String measureKey) throws SonarMeasureNotFoundException { Preconditions.checkArgument(!Strings.isNullOrEmpty(artifactId), "artifactId is a mandatory parameter"); Preconditions.checkNotNull(measureKey, "measureKey is a mandatory parameter"); return findMeasureFromSonar(artifactId, measureKey); } Sonar(String url);  Sonar(String url, String login, String password); Measure findMeasure(String artifactId, String measureKey); Resource findResource(String resourceId); Map<String, SonarQualityMetric> findMetrics(); Projects findProjects(); Project findProject(String projectKey); }
Sonar { public Measure findMeasure(String artifactId, String measureKey) throws SonarMeasureNotFoundException { Preconditions.checkArgument(!Strings.isNullOrEmpty(artifactId), "artifactId is a mandatory parameter"); Preconditions.checkNotNull(measureKey, "measureKey is a mandatory parameter"); return findMeasureFromSonar(artifactId, measureKey); } Sonar(String url);  Sonar(String url, String login, String password); Measure findMeasure(String artifactId, String measureKey); Resource findResource(String resourceId); Map<String, SonarQualityMetric> findMetrics(); Projects findProjects(); Project findProject(String projectKey);  }