View Javadoc
1   package org.codehaus.plexus.configuration.io;
2   
3   import java.io.StringReader;
4   import java.io.StringWriter;
5   
6   import junit.framework.TestCase;
7   
8   import org.codehaus.plexus.configuration.ConfigurationTestHelper;
9   import org.codehaus.plexus.configuration.PlexusConfiguration;
10  import org.codehaus.plexus.configuration.xml.XmlPlexusConfiguration;
11  import org.codehaus.plexus.util.xml.Xpp3Dom;
12  import org.codehaus.plexus.util.xml.Xpp3DomBuilder;
13  
14  public class XmlPlexusConfigurationWriterTest
15      extends TestCase
16  {
17  
18      public void testWrite()
19          throws Exception
20      {
21          PlexusConfiguration c = ConfigurationTestHelper.getTestConfiguration();
22  
23          XmlPlexusConfigurationWriter cw = new XmlPlexusConfigurationWriter();
24  
25          StringWriter writer = new StringWriter();
26  
27          cw.write( writer, c );
28  
29          Xpp3Dom dom = Xpp3DomBuilder.build( new StringReader( writer.toString() ) );
30  
31          XmlPlexusConfiguration c1 = new XmlPlexusConfiguration( dom );
32          
33          ConfigurationTestHelper.testConfiguration( c1 );
34      }
35  
36  }