EMMA Coverage Report (generated Sat Oct 08 11:41:37 CEST 2011)
[all classes][net.sf.jomic.comic]

COVERAGE SUMMARY FOR SOURCE FILE [BrokenComicArchiveTest.java]

nameclass, %method, %block, %line, %
BrokenComicArchiveTest.java100% (1/1)100% (4/4)76%  (75/99)90%  (18/20)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class BrokenComicArchiveTest100% (1/1)100% (4/4)76%  (75/99)90%  (18/20)
testBrokenArchive (): void 100% (1/1)59%  (17/29)86%  (6/7)
<static initializer> 100% (1/1)68%  (17/25)70%  (1.4/2)
BrokenComicArchiveTest (File): void 100% (1/1)76%  (13/17)92%  (4.6/5)
suite (): Test 100% (1/1)100% (28/28)100% (6/6)

1// Jomic - a viewer for comic book archives.
2// Copyright (C) 2004-2011 Thomas Aglassinger
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16package net.sf.jomic.comic;
17 
18import java.io.File;
19 
20import junit.framework.Test;
21import junit.framework.TestSuite;
22import net.sf.jomic.tools.TestTools;
23import org.apache.commons.logging.Log;
24import org.apache.commons.logging.LogFactory;
25 
26/**
27 *  TestCase to test that broken comic archives in <code>net.sf.jomic.tests.data</code> can not be
28 *  be opened.
29 *
30 * @author    Thomas Aglassinger
31 */
32public final class BrokenComicArchiveTest extends AbstractComicArchiveTest
33{
34    private static Log logger = LogFactory.getLog(BrokenComicArchiveTest.class);
35    private File archive;
36 
37    private BrokenComicArchiveTest(File newArchive) {
38        super();
39        assert newArchive != null;
40        setName("testBrokenArchive");
41        archive = newArchive;
42    }
43 
44    public static Test suite() {
45        TestSuite suite = new TestSuite();
46        TestTools testTools = TestTools.instance();
47        File[] archives = testTools.getTestFiles("^(broken).*\\.(cbz|cbr)$");
48 
49        for (int i = 0; i < archives.length; i += 1) {
50            suite.addTest(new BrokenComicArchiveTest(archives[i]));
51        }
52        return suite;
53    }
54 
55    public void testBrokenArchive()
56        throws Exception {
57        try {
58            testExtract(archive);
59            if (!archive.getName().startsWith("broken_image_")) {
60                fail("archive must be recognized as broken: \"" + archive + "\"");
61            }
62        } catch (Exception error) {
63            logger.debug("ignoring expected exception", error);
64        }
65    }
66}

[all classes][net.sf.jomic.comic]
EMMA 2.0.4217 (C) Vladimir Roubtsov