blob: 8967fe9afdf49dae116ce708773f892bbfa012b6 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.application;
import org.custommonkey.xmlunit.Diff;
import org.custommonkey.xmlunit.XMLUnit;
import org.w3c.dom.Document;
import java.io.Reader;
import java.io.StringReader;
import static org.junit.Assert.assertTrue;
/**
* Utilities for tests
*
* @author musum
*/
public class TestBase {
static {
XMLUnit.setIgnoreWhitespace(true);
}
static void assertDocument(String expected, Document output) {
Document expectedDoc = Xml.getDocument(new StringReader(expected));
Diff diff = new Diff(expectedDoc, output);
assertTrue(diff.toString(), diff.identical());
}
public static void assertDocument(String expectedDocument, Reader document) {
Document output = Xml.getDocument(document);
assertDocument(expectedDocument, output);
}
}
|