/*
 * T002a_Test.java
 * JUnit based test
 *
 * Created on 8. June 2007, 23:42
 */

package org.ujorm.implementation.xml.t002_tech;

import java.io.ByteArrayInputStream;
import java.io.CharArrayWriter;
import junit.framework.*;
import org.ujorm.MyTestCase;
import org.ujorm.UjoProperty;
import org.ujorm.core.UjoManagerXML;
import org.ujorm.UjoPropertyList;

/**
 *
 * @author Pavel Ponec
 */
public class T002c_Test extends MyTestCase {
    
    public T002c_Test(String testName) {
        super(testName);
    }
    
    public static TestSuite suite() {
        TestSuite suite = new TestSuite(T002c_Test.class);
        return suite;
    }
    
    protected void setUp() throws Exception {
        //UjoManager.getInstance().setZeroProviderEnabled(true);
    }
    
    protected void tearDown() throws Exception {
    }
    
    /**
     * Test of printProperties method, of class org.apache.person.implementation.imlXML.XmlUjo.
     */
    public void testRestoreXMLc() throws Exception {
        System.out.println("testRestoreXMLc: " + suite().toString());
        //
        CharArrayWriter writer = new CharArrayWriter(256);
        //
        UTechnicalBean person = createPerson();
        UjoManagerXML.getInstance().saveXML(writer, person, null, "TEST");
        if (true) {
            System.err.println("XML:\n" + writer.toString() );
        }
        
        ByteArrayInputStream is = new ByteArrayInputStream(writer.toString().getBytes("UTF-8"));
        UTechnicalBean person2 = UjoManagerXML.getInstance().parseXML(is, UTechnicalBean.class, false);
        
        assertEquals(person, person2);
    }
    
    
    
    protected UTechnicalBean createPerson() {
        UTechnicalBean result = new UTechnicalBean();
        UjoPropertyList props = result.readProperties();
        for (UjoProperty prop : props) {
            result.writeValue(prop, null);
        }
        return result;
    }
    
    public static void main(java.lang.String[] argList) {
        junit.textui.TestRunner.run(suite());
    }
    
}

@@ -1622,24 +1622,16 @@
 alse);%0D%0A
-        
 %0D%0A      
@@ -1799,16 +1799,21 @@
         
+for (
 UjoPrope
@@ -1819,20 +1819,15 @@
 erty
-List
  prop
-s =
+ :
  res
@@ -1850,48 +1850,8 @@
 es()
-;%0D%0A        for (UjoProperty prop : props
 ) %7B%0D

Test code cleaning