aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
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-plugin-api
parentc77bc1df270111bd96c300f4a7a856b71045737d (diff)
downloadsonarqube-1b000a65c28f43a3242c55f91a0cc7f6a210e979.tar.gz
sonarqube-1b000a65c28f43a3242c55f91a0cc7f6a210e979.zip
Don't use anyObject() matcher
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractDivisionDecoratorTest.java4
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSourceImporterTest.java13
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSumChildrenDecoratorTest.java12
3 files changed, 19 insertions, 10 deletions
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractDivisionDecoratorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractDivisionDecoratorTest.java
index 60b9d6cda1d..13ffa419564 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractDivisionDecoratorTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractDivisionDecoratorTest.java
@@ -55,7 +55,7 @@ public class AbstractDivisionDecoratorTest {
decorator.decorate(mock(Resource.class), context);
- verify(context, never()).saveMeasure((Measure) anyObject());
+ verify(context, never()).saveMeasure(any(Measure.class));
}
@Test
@@ -83,7 +83,7 @@ public class AbstractDivisionDecoratorTest {
decorator.decorate(mock(Resource.class), context);
- verify(context, never()).saveMeasure((Measure) anyObject());
+ verify(context, never()).saveMeasure(any(Measure.class));
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSourceImporterTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSourceImporterTest.java
index aaabf657d59..d2be8f62f2b 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSourceImporterTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSourceImporterTest.java
@@ -27,7 +27,12 @@ import org.junit.Before;
import org.junit.Test;
import org.mockito.ArgumentMatcher;
import org.mockito.exceptions.verification.junit.ArgumentsAreDifferent;
-import org.sonar.api.resources.*;
+import org.sonar.api.resources.Java;
+import org.sonar.api.resources.JavaFile;
+import org.sonar.api.resources.Language;
+import org.sonar.api.resources.Project;
+import org.sonar.api.resources.ProjectFileSystem;
+import org.sonar.api.resources.Resource;
import java.io.File;
import java.io.UnsupportedEncodingException;
@@ -39,7 +44,7 @@ import java.util.List;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.anyObject;
+import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.argThat;
import static org.mockito.Matchers.eq;
@@ -83,7 +88,7 @@ public class AbstractSourceImporterTest {
when(fileSystem.getSourceFiles(Java.INSTANCE)).thenReturn(Arrays.<File> asList(new File("Foo.java"), new File("Bar.java")));
nullImporter.analyse(fileSystem, context);
- verify(context, never()).saveSource((Resource) anyObject(), anyString());
+ verify(context, never()).saveSource(any(Resource.class), anyString());
}
@Test
@@ -121,7 +126,7 @@ public class AbstractSourceImporterTest {
when(project.getFileSystem()).thenReturn(fileSystem);
when(fileSystem.getSourceCharset()).thenReturn(Charset.forName(encoding));
when(project.getConfiguration()).thenReturn(new MapConfiguration(new HashMap<String, String>()));
- when(fileSystem.getSourceFiles((Language) anyObject())).thenReturn(Arrays.asList(
+ when(fileSystem.getSourceFiles(any(Language.class))).thenReturn(Arrays.asList(
new File("test-resources/org/sonar/api/batch/AbstractSourceImporterTest/encoding/" + testFile)));
importer.shouldExecuteOnProject(project);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSumChildrenDecoratorTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSumChildrenDecoratorTest.java
index 3d3e07fd8fb..b5537f437f5 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSumChildrenDecoratorTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/AbstractSumChildrenDecoratorTest.java
@@ -20,9 +20,6 @@
package org.sonar.api.batch;
import org.junit.Test;
-import static org.mockito.Matchers.anyObject;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Mockito.*;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.measures.Measure;
import org.sonar.api.measures.Metric;
@@ -31,6 +28,13 @@ import org.sonar.api.test.IsMeasure;
import java.util.Arrays;
import java.util.List;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
public class AbstractSumChildrenDecoratorTest {
@Test
@@ -52,7 +56,7 @@ public class AbstractSumChildrenDecoratorTest {
create(false).decorate(null, context);
- verify(context, never()).saveMeasure((Measure) anyObject());
+ verify(context, never()).saveMeasure(any(Measure.class));
}
@Test