diff options
author | David Gageot <david@gageot.net> | 2012-09-17 16:27:08 +0200 |
---|---|---|
committer | David Gageot <david@gageot.net> | 2012-09-20 12:07:32 +0200 |
commit | 1b000a65c28f43a3242c55f91a0cc7f6a210e979 (patch) | |
tree | 776139ba456138bd8042ef1f409121a057e10c4f /plugins/sonar-surefire-plugin | |
parent | c77bc1df270111bd96c300f4a7a856b71045737d (diff) | |
download | sonarqube-1b000a65c28f43a3242c55f91a0cc7f6a210e979.tar.gz sonarqube-1b000a65c28f43a3242c55f91a0cc7f6a210e979.zip |
Don't use anyObject() matcher
Diffstat (limited to 'plugins/sonar-surefire-plugin')
2 files changed, 36 insertions, 26 deletions
diff --git a/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/SurefireSensorTest.java b/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/SurefireSensorTest.java index 6e0c37c0996..e641d4a38b8 100644 --- a/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/SurefireSensorTest.java +++ b/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/SurefireSensorTest.java @@ -19,12 +19,6 @@ */ package org.sonar.plugins.surefire; -import static org.hamcrest.CoreMatchers.is; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.mockito.Matchers.*; -import static org.mockito.Mockito.*; - import org.apache.commons.lang.ObjectUtils; import org.custommonkey.xmlunit.DetailedDiff; import org.custommonkey.xmlunit.Diff; @@ -36,7 +30,12 @@ import org.sonar.api.batch.SensorContext; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; import org.sonar.api.measures.Metric; -import org.sonar.api.resources.*; +import org.sonar.api.resources.Java; +import org.sonar.api.resources.JavaFile; +import org.sonar.api.resources.Project; +import org.sonar.api.resources.Qualifiers; +import org.sonar.api.resources.Resource; +import org.sonar.api.resources.Scopes; import org.sonar.api.test.IsMeasure; import org.sonar.api.test.IsResource; import org.sonar.api.test.MavenTestUtils; @@ -46,6 +45,19 @@ import java.io.FileReader; import java.io.StringReader; import java.net.URISyntaxException; +import static org.hamcrest.CoreMatchers.is; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertThat; +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyDouble; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + public class SurefireSensorTest { @Test @@ -88,7 +100,7 @@ public class SurefireSensorTest { verify(context, times(3)).saveMeasure(argThat(new IsResource(Scopes.FILE, Qualifiers.UNIT_TEST_FILE)), eq(CoreMetrics.TESTS), anyDouble()); verify(context, times(18)).saveMeasure(argThat(new IsResource(Scopes.FILE, Qualifiers.UNIT_TEST_FILE)), - (Metric) anyObject(), anyDouble()); + any(Metric.class), anyDouble()); verify(context, times(3)).saveMeasure(argThat(new IsResource(Scopes.FILE, Qualifiers.UNIT_TEST_FILE)), argThat(new IsMeasure(CoreMetrics.TEST_DATA))); @@ -133,7 +145,7 @@ public class SurefireSensorTest { verify(context, times(1)).saveMeasure(argThat(new IsResource(Scopes.FILE, Qualifiers.UNIT_TEST_FILE)), eq(CoreMetrics.TESTS), anyDouble()); verify(context, times(6)).saveMeasure(argThat(new IsResource(Scopes.FILE, Qualifiers.UNIT_TEST_FILE)), - (Metric) anyObject(), anyDouble()); + any(Metric.class), anyDouble()); verify(context, times(1)).saveMeasure(argThat(new IsResource(Scopes.FILE, Qualifiers.UNIT_TEST_FILE)), argThat(new IsMeasure(CoreMetrics.TEST_DATA))); diff --git a/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/api/AbstractSurefireParserTest.java b/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/api/AbstractSurefireParserTest.java index b85b96a7910..7853b8d76b5 100644 --- a/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/api/AbstractSurefireParserTest.java +++ b/plugins/sonar-surefire-plugin/src/test/java/org/sonar/plugins/surefire/api/AbstractSurefireParserTest.java @@ -19,23 +19,8 @@ */ package org.sonar.plugins.surefire.api; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyDouble; -import static org.mockito.Matchers.anyObject; -import static org.mockito.Matchers.argThat; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.mockito.ArgumentMatcher; - -import java.net.URISyntaxException; -import java.util.Arrays; - import org.junit.Test; +import org.mockito.ArgumentMatcher; import org.sonar.api.batch.SensorContext; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; @@ -47,6 +32,19 @@ import org.sonar.api.resources.Scopes; import org.sonar.api.test.IsMeasure; import org.sonar.api.test.IsResource; +import java.net.URISyntaxException; +import java.util.Arrays; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyDouble; +import static org.mockito.Matchers.argThat; +import static org.mockito.Matchers.eq; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.never; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + public class AbstractSurefireParserTest { @Test @@ -112,7 +110,7 @@ public class AbstractSurefireParserTest { parser.collect(new Project("foo"), context, getDir("noTests")); - verify(context, never()).saveMeasure(any(Resource.class), (Metric) anyObject(), anyDouble()); + verify(context, never()).saveMeasure(any(Resource.class), any(Metric.class), anyDouble()); } @Test |