View Javadoc

1   /*
2    * $Id: XmlPrettyPrinterConfigurationTestCase.java 22414 2011-07-14 13:24:46Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.xml.config;
12  
13  import org.mule.module.xml.transformer.XmlPrettyPrinter;
14  import org.mule.tck.junit4.FunctionalTestCase;
15  
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertFalse;
20  import static org.junit.Assert.assertNotNull;
21  import static org.junit.Assert.assertTrue;
22  
23  public class XmlPrettyPrinterConfigurationTestCase extends FunctionalTestCase
24  {
25  
26      public XmlPrettyPrinterConfigurationTestCase()
27      {
28          setStartContext(false);
29      }
30  
31      @Override
32      protected String getConfigResources()
33      {
34          return "org/mule/module/xml/xml-prettyprinter-config.xml";
35      }
36  
37      @Test
38      public void testPrettyPrinter()
39      {
40          XmlPrettyPrinter pp = (XmlPrettyPrinter) muleContext.getRegistry().lookupTransformer("MyXMLPrettyPrinter");
41  
42          assertNotNull(pp);
43          assertEquals("ISO-8859-15", pp.getEncoding());
44          assertEquals(true, pp.isExpandEmptyElements());
45          assertEquals(true, pp.getIndentEnabled());
46          assertEquals("   ", pp.getIndentString());
47          assertEquals("\\n\\n", pp.getLineSeparator());
48          assertEquals(1, pp.getNewLineAfterNTags());
49          assertFalse(pp.isNewlines());
50          assertFalse(pp.isNewLineAfterDeclaration());
51          assertFalse(pp.isOmitEncoding());
52          assertFalse(pp.isPadText());
53          assertFalse(pp.isTrimText());
54          assertFalse(pp.isSuppressDeclaration());
55          assertTrue(pp.isXHTML());
56      }
57  }