diff options
author | Julien HENRY <julien.henry@sonarsource.com> | 2016-01-19 11:14:50 +0100 |
---|---|---|
committer | Julien HENRY <julien.henry@sonarsource.com> | 2016-01-19 14:45:02 +0100 |
commit | 3e6f3ed80c0b631d794bcb2e744f3517ad0db989 (patch) | |
tree | 9b8990e103de8c8e60fac04840f7f06fdd50898f /sonar-batch-protocol | |
parent | 7d272075f919cffb2a5806f20fe027dea1cb4b28 (diff) | |
download | sonarqube-3e6f3ed80c0b631d794bcb2e744f3517ad0db989.tar.gz sonarqube-3e6f3ed80c0b631d794bcb2e744f3517ad0db989.zip |
Cut many dependencies on sonar-testing-harness
Diffstat (limited to 'sonar-batch-protocol')
-rw-r--r-- | sonar-batch-protocol/pom.xml | 20 | ||||
-rw-r--r-- | sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java | 16 |
2 files changed, 26 insertions, 10 deletions
diff --git a/sonar-batch-protocol/pom.xml b/sonar-batch-protocol/pom.xml index 01b9a0e620d..183f29e98bd 100644 --- a/sonar-batch-protocol/pom.xml +++ b/sonar-batch-protocol/pom.xml @@ -47,8 +47,24 @@ <!-- unit tests --> <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>sonar-testing-harness</artifactId> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>net.javacrumbs.json-unit</groupId> + <artifactId>json-unit-assertj</artifactId> + <version>0.0.15</version> <scope>test</scope> </dependency> <dependency> diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java index ab6b6b120c7..fe0643b5c45 100644 --- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java +++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/GlobalRepositoriesTest.java @@ -19,32 +19,32 @@ */ package org.sonar.batch.protocol.input; +import org.apache.commons.io.IOUtils; import org.junit.Test; -import org.sonar.test.JsonAssert; +import static net.javacrumbs.jsonunit.assertj.JsonAssert.assertThatJson; import static org.assertj.core.api.Assertions.assertThat; public class GlobalRepositoriesTest { @Test - public void to_json() { + public void to_json() throws Exception { GlobalRepositories ref = new GlobalRepositories(); ref.addMetric(new Metric(1, "ncloc", "INT", "Description", -1, "NCLOC", true, false, 2.0, 1.0, true)); ref.addGlobalSetting("prop", "value"); ref.setTimestamp(10); - JsonAssert - .assertJson(ref.toJson()) - .isSimilarTo(getClass().getResource("GlobalRepositoriesTest/expected.json")); + assertThatJson(ref.toJson()) + .isEqualTo(IOUtils.toString(getClass().getResource("GlobalRepositoriesTest/expected.json"))); } @Test public void from_json() { GlobalRepositories ref = GlobalRepositories .fromJson( - "{timestamp:1," - + "metrics:[{id:1,key:ncloc,valueType:DATA,description:Description,direction:-1,name:NCLOC,qualitative:true,userManaged:false,worstValue:2.0,bestValue:1.0,optimizedBestValue:true}]," - + "globalSettings:{prop:value}}"); + "{timestamp:1," + + "metrics:[{id:1,key:ncloc,valueType:DATA,description:Description,direction:-1,name:NCLOC,qualitative:true,userManaged:false,worstValue:2.0,bestValue:1.0,optimizedBestValue:true}]," + + "globalSettings:{prop:value}}"); assertThat(ref.timestamp()).isEqualTo(1); Metric metric = ref.metrics().iterator().next(); |