aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-19 13:10:29 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2017-02-19 13:32:39 +0100
commit5b2ce72ec304284354e4786ac3afe6fb3dd24077 (patch)
tree5063d293d69f46f43e9d5c767f46bd6d0d1a8e44 /sonar-plugin-api
parent4dcf22377c7823584f0d9d7dbb85641980245fd8 (diff)
downloadsonarqube-5b2ce72ec304284354e4786ac3afe6fb3dd24077.tar.gz
sonarqube-5b2ce72ec304284354e4786ac3afe6fb3dd24077.zip
Drop dependency xmlunit
Replaced by assertJ assertThat().isXmlEqualTo()
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/pom.xml5
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java33
2 files changed, 7 insertions, 31 deletions
diff --git a/sonar-plugin-api/pom.xml b/sonar-plugin-api/pom.xml
index ee8f9a32bca..2a83f3319b0 100644
--- a/sonar-plugin-api/pom.xml
+++ b/sonar-plugin-api/pom.xml
@@ -172,11 +172,6 @@
<artifactId>sonar-testing-harness</artifactId>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>xmlunit</groupId>
- <artifactId>xmlunit</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
<build>
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java
index cd8da67c16d..95070b30a0f 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/profiles/XMLProfileSerializerTest.java
@@ -19,22 +19,17 @@
*/
package org.sonar.api.profiles;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.CharUtils;
-import org.custommonkey.xmlunit.Diff;
-import org.custommonkey.xmlunit.XMLUnit;
import org.junit.Test;
import org.sonar.api.rules.ActiveRule;
import org.sonar.api.rules.Rule;
import org.sonar.api.rules.RulePriority;
import org.xml.sax.SAXException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
public class XMLProfileSerializerTest {
@@ -75,22 +70,8 @@ public class XMLProfileSerializerTest {
assertSimilarXml("exportRuleParameters.xml", writer.toString());
}
- public static void assertSimilarXml(String fileWithExpectedXml, String xml) throws IOException, SAXException {
- String pathToExpectedXml = "/org/sonar/api/profiles/XMLProfileSerializerTest/" + fileWithExpectedXml;
- InputStream stream = XMLProfileSerializerTest.class.getResourceAsStream(pathToExpectedXml);
- try {
- Diff diff = isSimilarXml(IOUtils.toString(stream), xml);
- String message = "Diff: " + diff.toString() + CharUtils.LF + "XML: " + xml;
- assertTrue(message, diff.similar());
-
- } finally {
- IOUtils.closeQuietly(stream);
- }
- }
-
- static Diff isSimilarXml(String expectedXml, String xml) throws IOException, SAXException {
- XMLUnit.setIgnoreWhitespace(true);
- Diff diff = XMLUnit.compareXML(xml, expectedXml);
- return diff;
+ private void assertSimilarXml(String fileWithExpectedXml, String xml) throws IOException, SAXException {
+ String pathToExpectedXml = "XMLProfileSerializerTest/" + fileWithExpectedXml;
+ assertThat(xml).isXmlEqualTo(IOUtils.toString(getClass().getResource(pathToExpectedXml)));
}
}