diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-06-20 00:43:47 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-06-20 00:45:34 +0200 |
commit | 2f779df51e9da5b07ad6f837fe1c98eab9fbf439 (patch) | |
tree | d2be9202eb947ecb005c72368bbcb4f1b86e8e68 /sonar-ws-client/src/test/java/org | |
parent | 24ec2501f751dc2a122f1e5f905ee4151ec8b891 (diff) | |
download | sonarqube-2f779df51e9da5b07ad6f837fe1c98eab9fbf439.tar.gz sonarqube-2f779df51e9da5b07ad6f837fe1c98eab9fbf439.zip |
Upgrade hamcrest and fix conflicts with JUnit and Mockito
Diffstat (limited to 'sonar-ws-client/src/test/java/org')
14 files changed, 24 insertions, 29 deletions
diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java index e35edc16be9..c1ff002fa00 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/SonarTest.java @@ -20,6 +20,7 @@ package org.sonar.wsclient; import org.eclipse.jetty.testing.ServletTester; +import org.hamcrest.Matchers; import org.junit.AfterClass; import org.junit.Test; import org.junit.runner.RunWith; @@ -32,17 +33,11 @@ import org.sonar.wsclient.services.MetricQuery; import org.sonar.wsclient.services.Query; import org.sonar.wsclient.services.Server; import org.sonar.wsclient.services.ServerQuery; -import org.sonar.wsclient.unmarshallers.UnmarshalException; import java.util.Arrays; import java.util.Collection; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.number.OrderingComparisons.greaterThan; import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; -import static org.junit.internal.matchers.StringContains.containsString; @RunWith(value = Parameterized.class) public class SonarTest { @@ -86,20 +81,20 @@ public class SonarTest { @Test public void findAll() { Collection<Metric> metrics = sonar.findAll(MetricQuery.all()); - assertThat(metrics.size(), greaterThan(1)); + assertThat(metrics.size(), Matchers.greaterThan(1)); } @Test public void findEmptyResults() { Query<Metric> query = new EmptyQuery(); Collection<Metric> metrics = sonar.findAll(query); - assertThat(metrics.size(), is(0)); + assertThat(metrics.size(), Matchers.is(0)); } @Test public void returnNullWhenSingleResultNotFound() { Query<Metric> query = new EmptyQuery(); - assertThat(sonar.find(query), nullValue()); + assertThat(sonar.find(query), Matchers.nullValue()); } @Test(expected = ConnectionException.class) @@ -111,8 +106,8 @@ public class SonarTest { @Test public void getVersion() { Server server = sonar.find(new ServerQuery()); - assertThat(server.getId(), is("123456789")); - assertThat(server.getVersion(), is("2.0")); + assertThat(server.getId(), Matchers.is("123456789")); + assertThat(server.getVersion(), Matchers.is("2.0")); } static class EmptyQuery extends Query<Metric> { diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ResourceTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ResourceTest.java index 7ecc3b90a83..ad0a6b0c17e 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ResourceTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/services/ResourceTest.java @@ -21,8 +21,8 @@ package org.sonar.wsclient.services; import org.junit.Test; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.nullValue; import static org.junit.Assert.assertThat; public class ResourceTest { diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshallerTest.java index 4ea3d7eeffa..5f0482b0c06 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/DependencyUnmarshallerTest.java @@ -24,7 +24,7 @@ import org.sonar.wsclient.services.Dependency; import java.util.Collection; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/JsonUtilsTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/JsonUtilsTest.java index 1110782637a..80ea21fd094 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/JsonUtilsTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/JsonUtilsTest.java @@ -26,8 +26,8 @@ import org.junit.Test; import java.util.Date; import java.util.TimeZone; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.nullValue; import static org.junit.Assert.assertThat; public class JsonUtilsTest extends UnmarshallerTestCase { diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ManualMeasureUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ManualMeasureUnmarshallerTest.java index 5cd345ab8f9..4285e32a9aa 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ManualMeasureUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ManualMeasureUnmarshallerTest.java @@ -24,7 +24,7 @@ import org.sonar.wsclient.services.ManualMeasure; import java.util.List; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/MetricUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/MetricUnmarshallerTest.java index 5a183b876c9..a73943a974c 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/MetricUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/MetricUnmarshallerTest.java @@ -24,7 +24,7 @@ import org.sonar.wsclient.services.Metric; import java.util.Collection; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ProfileUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ProfileUnmarshallerTest.java index 50a306b9a27..2037a5295b4 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ProfileUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ProfileUnmarshallerTest.java @@ -23,7 +23,7 @@ import org.hamcrest.CoreMatchers; import org.junit.Test; import org.sonar.wsclient.services.Profile; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PropertyUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PropertyUnmarshallerTest.java index 5de7f5b110d..77d10945c78 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PropertyUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/PropertyUnmarshallerTest.java @@ -24,7 +24,7 @@ import org.sonar.wsclient.services.Property; import java.util.Collection; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshallerTest.java index 7e0c31f478b..fbca555edc8 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceSearchUnmarshallerTest.java @@ -23,7 +23,7 @@ import org.junit.Test; import org.sonar.wsclient.services.ResourceSearchResult; import org.sonar.wsclient.services.Server; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshallerTest.java index 4fac008d1a0..cc2f1f64faf 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ResourceUnmarshallerTest.java @@ -24,8 +24,8 @@ import org.sonar.wsclient.services.Resource; import java.util.List; -import static org.hamcrest.CoreMatchers.not; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.not; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshallerTest.java index 149f767e209..a8eeaaea3e2 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerSetupUnmarshallerTest.java @@ -22,7 +22,7 @@ package org.sonar.wsclient.unmarshallers; import org.junit.Test; import org.sonar.wsclient.services.ServerSetup; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerUnmarshallerTest.java index 086a615e161..576075e72a1 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/ServerUnmarshallerTest.java @@ -22,7 +22,7 @@ package org.sonar.wsclient.unmarshallers; import org.junit.Test; import org.sonar.wsclient.services.Server; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/SourceUnmarshallerTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/SourceUnmarshallerTest.java index 97c8edeef4e..5acb55f1c8d 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/SourceUnmarshallerTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/SourceUnmarshallerTest.java @@ -22,7 +22,7 @@ package org.sonar.wsclient.unmarshallers; import org.junit.Test; import org.sonar.wsclient.services.Source; -import static org.hamcrest.CoreMatchers.nullValue; +import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.Is.is; import static org.junit.Assert.assertThat; diff --git a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/UnmarshallersTest.java b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/UnmarshallersTest.java index 6cca8815084..8b32b8f2e2c 100644 --- a/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/UnmarshallersTest.java +++ b/sonar-ws-client/src/test/java/org/sonar/wsclient/unmarshallers/UnmarshallersTest.java @@ -23,15 +23,15 @@ import org.junit.Test; import org.sonar.wsclient.services.Metric; import org.sonar.wsclient.services.Model; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.core.Is.is; +import static org.hamcrest.Matchers.nullValue; +import static org.hamcrest.Matchers.instanceOf; import static org.junit.Assert.assertThat; public class UnmarshallersTest { @Test public void forModel() { - assertThat(Unmarshallers.forModel(Metric.class), is(MetricUnmarshaller.class)); + assertThat(Unmarshallers.forModel(Metric.class), instanceOf(MetricUnmarshaller.class)); assertThat(Unmarshallers.forModel(Model.class), nullValue()); } |