summaryrefslogtreecommitdiffstats
path: root/sonar-batch/src
diff options
context:
space:
mode:
authorDavid Gageot <david@gageot.net>2012-09-17 16:27:08 +0200
committerDavid Gageot <david@gageot.net>2012-09-20 12:07:32 +0200
commit1b000a65c28f43a3242c55f91a0cc7f6a210e979 (patch)
tree776139ba456138bd8042ef1f409121a057e10c4f /sonar-batch/src
parentc77bc1df270111bd96c300f4a7a856b71045737d (diff)
downloadsonarqube-1b000a65c28f43a3242c55f91a0cc7f6a210e979.tar.gz
sonarqube-1b000a65c28f43a3242c55f91a0cc7f6a210e979.zip
Don't use anyObject() matcher
Diffstat (limited to 'sonar-batch/src')
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/FormulaDecoratorTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/components/PastSnapshotFinderTest.java8
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/index/SourcePersisterTest.java4
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/phases/MavenPluginsConfiguratorTest.java4
4 files changed, 9 insertions, 9 deletions
diff --git a/sonar-batch/src/test/java/org/sonar/batch/FormulaDecoratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/FormulaDecoratorTest.java
index e648f9f1baf..db91c6434f1 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/FormulaDecoratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/FormulaDecoratorTest.java
@@ -77,7 +77,7 @@ public class FormulaDecoratorTest {
when(context.getMeasure(fake)).thenReturn(new Measure(fake, 10.0));
decorator.decorate(null, context);
- verify(context, never()).saveMeasure((Measure) anyObject());
+ verify(context, never()).saveMeasure(any(Measure.class));
}
class FakeFormula implements Formula {
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 f25775962c6..ed37f5dcdbe 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
@@ -33,6 +33,7 @@ import org.sonar.api.database.model.Snapshot;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import static org.mockito.Matchers.any;
import static junit.framework.Assert.assertNull;
import static org.hamcrest.Matchers.nullValue;
@@ -40,7 +41,6 @@ import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNot.not;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-import static org.mockito.Matchers.anyObject;
import static org.mockito.Matchers.argThat;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -111,7 +111,7 @@ public class PastSnapshotFinderTest {
PastSnapshot variationSnapshot = finder.find(null, 2, "2010-05-18");
- verify(finderByDate).findByDate((Snapshot) anyObject(), argThat(new ArgumentMatcher<Date>() {
+ verify(finderByDate).findByDate(any(Snapshot.class), argThat(new ArgumentMatcher<Date>() {
@Override
public boolean matches(Object o) {
return o.equals(date);
@@ -124,11 +124,11 @@ public class PastSnapshotFinderTest {
@Test
public void shouldNotFindByDate() {
- when(finderByDate.findByDate((Snapshot) anyObject(), (Date) anyObject())).thenReturn(null);
+ when(finderByDate.findByDate(any(Snapshot.class), any(Date.class))).thenReturn(null);
PastSnapshot variationSnapshot = finder.find(null, 2, "2010-05-18");
- verify(finderByDate).findByDate((Snapshot) anyObject(), (Date) anyObject());
+ verify(finderByDate).findByDate(any(Snapshot.class), any(Date.class));
assertNull(variationSnapshot);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/index/SourcePersisterTest.java b/sonar-batch/src/test/java/org/sonar/batch/index/SourcePersisterTest.java
index 4febb06f6d5..2fba10d0ee7 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/index/SourcePersisterTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/index/SourcePersisterTest.java
@@ -27,7 +27,7 @@ import org.sonar.api.resources.JavaFile;
import org.sonar.api.resources.Resource;
import org.sonar.jpa.test.AbstractDbUnitTestCase;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -40,7 +40,7 @@ public class SourcePersisterTest extends AbstractDbUnitTestCase {
setupData("shared");
Snapshot snapshot = getSession().getSingleResult(Snapshot.class, "id", 1000);
ResourcePersister resourcePersister = mock(ResourcePersister.class);
- when(resourcePersister.getSnapshotOrFail((Resource) anyObject())).thenReturn(snapshot);
+ when(resourcePersister.getSnapshotOrFail(any(Resource.class))).thenReturn(snapshot);
sourcePersister = new SourcePersister(getSession(), resourcePersister);
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/phases/MavenPluginsConfiguratorTest.java b/sonar-batch/src/test/java/org/sonar/batch/phases/MavenPluginsConfiguratorTest.java
index bddf0031a1b..558d8df3049 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/phases/MavenPluginsConfiguratorTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/phases/MavenPluginsConfiguratorTest.java
@@ -29,7 +29,7 @@ import org.sonar.api.test.MavenTestUtils;
import java.util.Arrays;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.any;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
@@ -40,7 +40,7 @@ public class MavenPluginsConfiguratorTest {
private MavenPluginsConfigurator newConfigurator(MavenPluginHandler... handlers) {
BatchExtensionDictionnary selector = mock(BatchExtensionDictionnary.class);
- when(selector.selectMavenPluginHandlers((Project) anyObject())).thenReturn(Arrays.asList(handlers));
+ when(selector.selectMavenPluginHandlers(any(Project.class))).thenReturn(Arrays.asList(handlers));
return new MavenPluginsConfigurator(selector);
}