diff options
author | David Gageot <david@gageot.net> | 2012-05-25 09:09:52 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-05-25 09:10:09 +0200 |
commit | c6dc564b20d039045b6f5ce90232c19dab520abb (patch) | |
tree | c692278d37b9e101101577efee075990b82e9230 /sonar-batch | |
parent | 7c03664400952bb5497e07a76e4d26bd9a22b7d3 (diff) | |
download | sonarqube-c6dc564b20d039045b6f5ce90232c19dab520abb.tar.gz sonarqube-c6dc564b20d039045b6f5ce90232c19dab520abb.zip |
Technical debt : Replace BaseMatcher with ArgumentMatcher
Diffstat (limited to 'sonar-batch')
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java | 10 | ||||
-rw-r--r-- | sonar-batch/src/test/java/org/sonar/batch/components/TimeMachineConfigurationTest.java | 23 |
2 files changed, 13 insertions, 20 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java b/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java index 2ab6d29a945..5f03dce9160 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java @@ -20,10 +20,9 @@ package org.sonar.batch.components; import org.apache.commons.configuration.PropertiesConfiguration; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; import org.junit.Before; import org.junit.Test; +import org.mockito.ArgumentMatcher; import org.sonar.api.CoreProperties; import org.sonar.api.database.model.Snapshot; @@ -89,14 +88,11 @@ public class PastSnapshotFinderTest { PastSnapshot variationSnapshot = finder.find(null, 2, "2010-05-18"); - verify(finderByDate).findByDate((Snapshot) anyObject(), argThat(new BaseMatcher<Date>() { + verify(finderByDate).findByDate((Snapshot) anyObject(), argThat(new ArgumentMatcher<Date>() { + @Override public boolean matches(Object o) { return o.equals(date); } - - public void describeTo(Description description) { - - } })); assertThat(variationSnapshot.getIndex(), is(2)); assertThat(variationSnapshot.getMode(), is("date")); diff --git a/sonar-batch/src/test/java/org/sonar/batch/components/TimeMachineConfigurationTest.java b/sonar-batch/src/test/java/org/sonar/batch/components/TimeMachineConfigurationTest.java index 68468e09e7e..7f378eef08a 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/components/TimeMachineConfigurationTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/components/TimeMachineConfigurationTest.java @@ -19,6 +19,14 @@ */ package org.sonar.batch.components; +import org.apache.commons.configuration.PropertiesConfiguration; +import org.junit.Test; +import org.mockito.ArgumentMatcher; +import org.sonar.api.CoreProperties; +import org.sonar.api.database.model.Snapshot; +import org.sonar.api.resources.Project; +import org.sonar.jpa.test.AbstractDbUnitTestCase; + import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; import static org.mockito.Matchers.argThat; @@ -27,15 +35,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyZeroInteractions; -import org.apache.commons.configuration.PropertiesConfiguration; -import org.hamcrest.BaseMatcher; -import org.hamcrest.Description; -import org.junit.Test; -import org.sonar.api.CoreProperties; -import org.sonar.api.database.model.Snapshot; -import org.sonar.api.resources.Project; -import org.sonar.jpa.test.AbstractDbUnitTestCase; - public class TimeMachineConfigurationTest extends AbstractDbUnitTestCase { @Test @@ -63,13 +62,11 @@ public class TimeMachineConfigurationTest extends AbstractDbUnitTestCase { new TimeMachineConfiguration(getSession(), new Project("my:project"), conf, pastSnapshotFinder); - verify(pastSnapshotFinder).find(argThat(new BaseMatcher<Snapshot>() { + verify(pastSnapshotFinder).find(argThat(new ArgumentMatcher<Snapshot>() { + @Override public boolean matches(Object o) { return ((Snapshot) o).getResourceId() == 2 /* see database in shared.xml */; } - - public void describeTo(Description description) { - } }), eq(conf), eq(1)); } |