View Javadoc
1   package org.kuali.ole.docstore.common.document;
2   
3   import org.apache.commons.io.FileUtils;
4   import org.apache.log4j.Logger;
5   import org.junit.Test;
6   import org.kuali.ole.docstore.common.util.ParseXml;
7   
8   import java.io.File;
9   
10  /**
11   * Created with IntelliJ IDEA.
12   * User: chenchulakshmig
13   * Date: 2/27/14
14   * Time: 4:20 PM
15   * To change this template use File | Settings | File Templates.
16   */
17  public class Licenses_UT {
18      private static final Logger LOG = Logger.getLogger(Licenses_UT.class);
19  
20      @Test
21      public void deserializeAndSerialize() {
22          String input = "";
23          File file = null;
24          try {
25              file = new File(getClass().getResource("/documents/Licenses1.xml").toURI());
26              input = FileUtils.readFileToString(file);
27          } catch (Exception e) {
28              LOG.error("Exception :", e);
29          }
30          Licenses licenses = new Licenses();
31          licenses = (Licenses) Licenses.deserialize(input);
32          String serializeXml = licenses.serialize(licenses);
33          serializeXml = ParseXml.formatXml(serializeXml);
34          System.out.print(serializeXml);
35      }
36  }