Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use xml unit to compare xml content #468

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions pom.xml
Expand Up @@ -301,6 +301,18 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-legacy</artifactId>
<version>2.9.1</version>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -512,6 +524,7 @@
<pomExclude>download-licenses-basic/pom.xml</pomExclude>
<pomExclude>download-licenses-force/pom.xml</pomExclude>
</pomExcludes>
<addTestClassPath>true</addTestClassPath>
</configuration>
</execution>
<!-- as this it is run in offline, then execute it after the previous its... -->
Expand Down
9 changes: 8 additions & 1 deletion src/it/ISSUE-80/postbuild.groovy
Expand Up @@ -20,7 +20,14 @@
* #L%
*/

import org.custommonkey.xmlunit.*
XMLUnit.setIgnoreWhitespace(true)

file = new File(basedir, 'target/licenses.xml');
expectedFile = new File(basedir, 'expected_licenses.xml');
assert expectedFile.text.equals(file.text);

def xmlDiff = new Diff(file.text, expectedFile.text)
assert xmlDiff.similar()
assert xmlDiff.identical()

return true;