Skip to content

Commit 704023d

Browse files
committed
. t ValidXML test
1 parent be2d0c1 commit 704023d

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

approvaltests-tests/src/test/java/org/approvaltests/JsonAprovalsTest.verifyJsonReorderWithArray.approved.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

approvaltests-tests/src/test/java/org/approvaltests/scrubbers/DateScrubberTest.textExamples.approved.txt

Whitespace-only changes.

approvaltests-tests/src/test/java/org/approvaltests/writers/ApprovalXmlWriterTest.invalidXml.approved.xml

Lines changed: 0 additions & 1 deletion
This file was deleted.

approvaltests-tests/src/test/java/org/approvaltests/writers/ApprovalXmlWriterTest.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import org.approvaltests.Approvals;
44
import org.approvaltests.core.Options;
55
import org.approvaltests.scrubbers.RegExScrubber;
6+
import org.approvaltests.utils.ConsoleOutput;
67
import org.junit.jupiter.api.Test;
78

89
public class ApprovalXmlWriterTest
@@ -33,7 +34,23 @@ public void xmlWithDeepAttributesWithScrubber()
3334
@Test
3435
public void invalidXml()
3536
{
36-
Approvals.verifyXml("<xml><hello/><start>hi</xml>");
37-
System.err.println("Note: The previous xml error (</start>) is expected ");
37+
var expected = """
38+
<xml><hello/><start>hi</xml>
39+
""";
40+
try (var __ = new ConsoleOutput())
41+
{
42+
Approvals.verifyXml("<xml><hello/><start>hi</xml>", new Options().inline(expected));
43+
}
44+
}
45+
@Test
46+
public void validXml()
47+
{
48+
var expected = """
49+
<?xml version="1.0" encoding="UTF-8"?><xml>
50+
<hello/>
51+
<start>hi</start>
52+
</xml>
53+
""";
54+
Approvals.verifyXml("<xml><hello/><start>hi</start></xml>", new Options().inline(expected));
3855
}
3956
}

0 commit comments

Comments
 (0)