~ubuntu-branches/ubuntu/vivid/doxia/vivid-proposed

« back to all changes in this revision

Viewing changes to doxia-book/src/test/java/org/apache/maven/doxia/book/BookRendererTest.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2009-10-08 14:20:22 UTC
  • mfrom: (2.3.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091008142022-f6ccxganfr2tbaig
Tags: 1.1-3build1
Upload to karmic, avoiding new version from unstable. LP: #443292.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 
22
22
import org.codehaus.plexus.PlexusTestCase;
23
23
import org.codehaus.plexus.util.FileUtils;
 
24
import org.codehaus.plexus.util.StringUtils;
24
25
import org.apache.maven.doxia.book.model.BookModel;
25
26
 
26
27
import java.io.File;
28
29
 
29
30
/**
30
31
 * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
31
 
 * @version $Id: BookRendererTest.java 572961 2007-09-05 14:40:04Z ltheussl $
 
32
 * @version $Id: BookRendererTest.java 707844 2008-10-25 13:41:29Z vsiveton $
32
33
 */
33
34
public class BookRendererTest
34
35
    extends PlexusTestCase
50
51
        doxia.renderBook( book, "latex", files, getTestFile( "target/test-output/latex" ) );
51
52
        doxia.renderBook( book, "doc-book", files, getTestFile( "target/test-output/doc-book" ) );
52
53
        doxia.renderBook( book, "rtf", files, getTestFile( "target/test-output/rtf" ) );
 
54
 
 
55
        assertCorrectDocbook();
 
56
    }
 
57
 
 
58
    /**
 
59
     * Regression test for the docbook output.
 
60
     */
 
61
    private void assertCorrectDocbook()
 
62
        throws Exception
 
63
    {
 
64
        String expected =
 
65
            FileUtils.fileRead( getTestFile( "src/test/resources/expected/doc-book/plexus-user-guide.xml" ) );
 
66
        expected = StringUtils.deleteWhitespace( expected );
 
67
 
 
68
        String actual =
 
69
            FileUtils.fileRead( getTestFile( "target/test-output/doc-book/plexus-user-guide.xml" ) );
 
70
        actual = StringUtils.deleteWhitespace( actual );
 
71
 
 
72
        assertEquals( "Wrong docbook output!",
 
73
            StringUtils.replace( expected, "\r", "" ), StringUtils.replace( actual, "\r", "" ) );
53
74
    }
54
75
}