Search in sources :

Example 11 with OPSPublication

use of org.eclipse.mylyn.docs.epub.core.OPSPublication in project mylyn.docs by eclipse.

the class TestPublication method testPack_Empty.

/**
 * Test method for {@link org.eclipse.mylyn.docs.epub.core.Publication#pack(java.io.File)}. An EPUB where only a
 * single page has been added shall be packed without issues
 *
 * @throws Exception
 */
/* Bug 454932 - fix or remove failing EPUB test
	@Test
	public final void testPack_EPUB2() throws Exception {
		oebps.addItem(new File("testdata/plain-page.xhtml"));
		epub.add(oebps);
		epub.pack(epubFile);
		oebps.validateMetadata();
		Report report = new DefaultReportImpl(epubFile.toString());
		EpubCheck checker = new EpubCheck(epubFile, report);
		System.out.println("Validating plain EPUB 2.0.1 file");
		System.out.println("Using version " + EpubCheck.version() + " of EpubCheck.");
		Assert.assertTrue(checker.validate());
	}
	 */
/**
 * Test method for {@link org.eclipse.mylyn.docs.epub.core.Publication#pack(java.io.File)}. An EPUB with no content
 * shall fail when packed.
 *
 * @throws Exception
 */
@Test
public final void testPack_Empty() throws Exception {
    epub.add(new OPSPublication());
    try {
        epubFile.delete();
        epub.pack(epubFile);
        fail();
    } catch (ValidationException e) {
    }
}
Also used : ValidationException(org.eclipse.mylyn.docs.epub.core.ValidationException) OPSPublication(org.eclipse.mylyn.docs.epub.core.OPSPublication) Test(org.junit.Test)

Example 12 with OPSPublication

use of org.eclipse.mylyn.docs.epub.core.OPSPublication in project mylyn.docs by eclipse.

the class TestEclipseTocImporter method setUp.

@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    oebps = new OPSPublication(logger);
}
Also used : OPSPublication(org.eclipse.mylyn.docs.epub.core.OPSPublication) Before(org.junit.Before)

Aggregations

OPSPublication (org.eclipse.mylyn.docs.epub.core.OPSPublication)12 Test (org.junit.Test)9 EPUB (org.eclipse.mylyn.docs.epub.core.EPUB)8 Publication (org.eclipse.mylyn.docs.epub.core.Publication)8 RootFile (org.eclipse.mylyn.docs.epub.ocf.RootFile)8 File (java.io.File)7 Before (org.junit.Before)3 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 ValidationException (org.eclipse.mylyn.docs.epub.core.ValidationException)1 Container (org.eclipse.mylyn.docs.epub.ocf.Container)1 RootFiles (org.eclipse.mylyn.docs.epub.ocf.RootFiles)1