cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Johannes Lichtenberger <Johannes.Lichtenber...@uni-konstanz.de>
Subject Unit tests...
Date Thu, 18 Mar 2010 20:53:19 GMT
Hi,

I've tried to test my generator like I've found an "example" from the
XMLSerializer (in trunk version):

  @Test
  public void testGenerator() throws Exception {
    runPipeline(new SAXGenerator(), XML);
  }

  private static void runPipeline(
      final SAXProducer generator,
      final String expectedContent) throws Exception {
    final Pipeline<SAXPipelineComponent> pipeline =
        new NonCachingPipeline<SAXPipelineComponent>();
    pipeline.addComponent(generator);
    pipeline.addComponent(new XMLSerializer());

    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
    pipeline.setup(baos);
    pipeline.execute();

    Assert.assertTrue(new Diff(expectedContent,
baos.toString()).similar());
  }

I've tested within a browser and it sends the expected output (but
without any content type), but in this case "baos" is empty (seen in the
debugger when extracted to a String). So I'm getting an error:

[Fatal Error] :1:1: Premature end of file.

greetings,
Johannes


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message