1
2
3
4
5
6
7 package org.mule.module.xml.config;
8
9 import org.mule.module.xml.transformer.XmlPrettyPrinter;
10 import org.mule.tck.junit4.FunctionalTestCase;
11
12 import org.junit.Test;
13
14 import static org.junit.Assert.assertEquals;
15 import static org.junit.Assert.assertFalse;
16 import static org.junit.Assert.assertNotNull;
17 import static org.junit.Assert.assertTrue;
18
19 public class XmlPrettyPrinterConfigurationTestCase extends FunctionalTestCase
20 {
21
22 public XmlPrettyPrinterConfigurationTestCase()
23 {
24 setStartContext(false);
25 }
26
27 @Override
28 protected String getConfigResources()
29 {
30 return "org/mule/module/xml/xml-prettyprinter-config.xml";
31 }
32
33 @Test
34 public void testPrettyPrinter()
35 {
36 XmlPrettyPrinter pp = (XmlPrettyPrinter) muleContext.getRegistry().lookupTransformer("MyXMLPrettyPrinter");
37
38 assertNotNull(pp);
39 assertEquals("ISO-8859-15", pp.getEncoding());
40 assertEquals(true, pp.isExpandEmptyElements());
41 assertEquals(true, pp.getIndentEnabled());
42 assertEquals(" ", pp.getIndentString());
43 assertEquals("\\n\\n", pp.getLineSeparator());
44 assertEquals(1, pp.getNewLineAfterNTags());
45 assertFalse(pp.isNewlines());
46 assertFalse(pp.isNewLineAfterDeclaration());
47 assertFalse(pp.isOmitEncoding());
48 assertFalse(pp.isPadText());
49 assertFalse(pp.isTrimText());
50 assertFalse(pp.isSuppressDeclaration());
51 assertTrue(pp.isXHTML());
52 }
53 }