Package org.apache.stratum.xo.cdata

Source Code of org.apache.stratum.xo.cdata.TestCDATAMapper

package org.apache.stratum.xo.cdata;

import java.io.File;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;

import org.apache.stratum.xo.Mapper;

public class TestCDATAMapper
    extends TestCase
{
    private static String TEST_DOCUMENT =
        "src/test/org/apache/stratum/xo/cdata/person.xml";
       
    private static String TEST_CLASS =
        "org.apache.stratum.xo.cdata.Person";

    public TestCDATAMapper(String testName)
    {
        super(testName);
    }

    public static Test suite()
    {
        return new TestSuite(TestCDATAMapper.class);
    }

    public void setUp()
    {
    }
  
    public void tearDown()
    {
    }

    public void testPersonMapping()
    {
        try
        {
            Mapper m = new Mapper();
            m.setDebug(true);
            Person p = (Person) m.map(new File(TEST_DOCUMENT), TEST_CLASS);
           
            assertEquals("Jason",p.getFirstName());
            assertEquals("van Zyl",p.getLastName());
            assertEquals("somnambulism",p.getHobby(0));
            assertEquals("<b>This is my homepage!</b>",p.getHomepage());
            assertEquals("squash",p.getHobby(1));
            assertEquals("squash",p.getHobby(1));
        }           
        catch (Exception e)
        {
            e.printStackTrace();
            fail(e.getMessage());
        }
    }
}
TOP

Related Classes of org.apache.stratum.xo.cdata.TestCDATAMapper

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.