commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject cvs commit: jakarta-commons/betwixt/src/test/org/apache/commons/betwixt AbstractTestCase.java TestRSSRoundTrip.java
Date Mon, 23 Dec 2002 20:04:09 GMT
rdonkin     2002/12/23 12:04:08

  Modified:    betwixt/src/test/org/apache/commons/betwixt
                        AbstractTestCase.java TestRSSRoundTrip.java
  Log:
  Added a test case but had to switch it off since it requires a feature that hasn't been
added yet. Don't want to add any more features until we've got a baseline release for other
projects to depend on
  
  Revision  Changes    Path
  1.6       +2 -1      jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/AbstractTestCase.java
  
  Index: AbstractTestCase.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/AbstractTestCase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AbstractTestCase.java	7 Nov 2002 16:15:08 -0000	1.5
  +++ AbstractTestCase.java	23 Dec 2002 20:04:08 -0000	1.6
  @@ -79,13 +79,14 @@
   
   import org.apache.commons.betwixt.io.BeanWriter;
   
  +import org.apache.commons.betwixt.xmlunit.XmlTestCase;
   
   /** Abstract base class for test cases.
     *
     * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
     * @version $Revision$
     */
  -public abstract class AbstractTestCase extends TestCase {
  +public abstract class AbstractTestCase extends XmlTestCase {
       
       /**
        * Basedir for all i/o
  
  
  
  1.3       +34 -0     jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java
  
  Index: TestRSSRoundTrip.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/betwixt/src/test/org/apache/commons/betwixt/TestRSSRoundTrip.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestRSSRoundTrip.java	26 Jul 2002 21:04:05 -0000	1.2
  +++ TestRSSRoundTrip.java	23 Dec 2002 20:04:08 -0000	1.3
  @@ -196,9 +196,43 @@
           assertEquals( "Round trip value should remain unchanged", text, text2 );
       }
       
  +    public void testRSSRead() throws Exception {
  +    /* 
  +        this test isn't working at the moment.
  +        the problem seems to be that you can't configure betwixt to ignore empty elements
  +    
  +        // create a BeanReader
  +        BeanReader reader = new BeanReader();
  +        reader.registerBeanClass( Channel.class );
  +
  +        // Register local copies of the DTDs we understand
  +        for (int i = 0; i < registrations.length; i += 2) {
  +            URL url = RSSDigester.class.getResource(registrations[i + 1]);
  +            if (url != null) {
  +                reader.register(registrations[i], url.toString());
  +            }
  +        }
  +        
  +        Object bean = reader.parse(
  +            new FileInputStream( getTestFile("src/test/org/apache/commons/betwixt/rss-example.xml")
));
  +        
  +        StringWriter out = new StringWriter();
  +        out.write( "<?xml version='1.0'?>" );
  +        write( bean, out );
  +            
  +        String xml = out.toString();
  +        System.out.println( xml );
  +        
  +        xmlAssertIsomorphic(
  +            parseString( xml ), 
  +            parseFile( "src/test/org/apache/commons/betwixt/rss-example.xml" ));
  +    */
  +    }
  +    
       protected void write(Object bean, Writer out) throws Exception {
           BeanWriter writer = new BeanWriter(out);
           writer.getXMLIntrospector().setAttributesForPrimitives(false);
  +        writer.setWriteIDs(false);
           writer.enablePrettyPrint();
           writer.write( bean );
       }
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message