1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.rat.report.xml.writer;
20
21 import org.apache.rat.report.xml.writer.impl.base.XmlWriter;
22 import org.apache.rat.testhelpers.XmlUtils;
23 import org.junit.jupiter.api.BeforeEach;
24 import org.junit.jupiter.api.Test;
25
26 import java.io.StringWriter;
27
28 import static org.junit.jupiter.api.Assertions.assertEquals;
29
30 public class XmlWriterUtilsTest {
31
32 private StringWriter out;
33 private IXmlWriter writer;
34
35 @BeforeEach
36 public void setUp() throws Exception {
37 out = new StringWriter();
38 writer = new XmlWriter(out);
39 writer.openElement("alpha");
40 }
41
42 @Test
43 public void writeTrue() throws Exception {
44 XmlUtils.writeAttribute(writer, "name", true);
45 assertEquals("<alpha name='true'", out.toString(), "Attribute written as True");
46 }
47
48 @Test
49 public void writeFalse() throws Exception {
50 XmlUtils.writeAttribute(writer, "name", false);
51 assertEquals("<alpha name='false'", out.toString(), "Attribute written as False");
52 }
53 }