diff options
author | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-03-11 12:11:03 +0100 |
---|---|---|
committer | Jean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com> | 2014-03-11 12:11:10 +0100 |
commit | 339c8f6b3cd44c5c305ee6e82b4c55c958fb1788 (patch) | |
tree | bc3b39c43a76cc6cec99efb512574d93f9f99e3f /sonar-batch/src/test/java/org | |
parent | 4ed48fb36439af64821def82ecbe546ec47deede (diff) | |
download | sonarqube-339c8f6b3cd44c5c305ee6e82b4c55c958fb1788.tar.gz sonarqube-339c8f6b3cd44c5c305ee6e82b4c55c958fb1788.zip |
SONAR-5094 Memoize loaded quality gate (do not reload on next provide call)
Diffstat (limited to 'sonar-batch/src/test/java/org')
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateProviderTest.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateProviderTest.java index 46729866736..739a380d4fa 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/qualitygate/QualityGateProviderTest.java @@ -40,9 +40,7 @@ import java.net.HttpURLConnection; import java.util.Collection; import static org.fest.assertions.Assertions.assertThat; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.mockito.Mockito.*; @RunWith(MockitoJUnitRunner.class) public class QualityGateProviderTest { @@ -71,9 +69,11 @@ public class QualityGateProviderTest { @Test public void should_load_empty_quality_gate_from_default_settings() { - assertThat(new QualityGateProvider().provide(settings, client, metricFinder).conditions()).isEmpty(); - assertThat(new QualityGateProvider().init(settings, client, metricFinder, logger).isEnabled()).isFalse(); - verify(logger).info("No quality gate is configured."); + QualityGateProvider provider = new QualityGateProvider(); + assertThat(provider.provide(settings, client, metricFinder).conditions()).isEmpty(); + assertThat(provider.init(settings, client, metricFinder, logger).isEnabled()).isFalse(); + verify(logger, times(1)).info("No quality gate is configured."); + verify(settings, times(2)).getString("sonar.qualitygate"); } @Test |