EMMA Coverage Report (generated Sun Apr 20 22:38:01 CEST 2008)
[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-2008 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 net.sf.wraplog.Logger;
24 
25/**
26 *  TestCase to test that broken comic archives in <code>net.sf.jomic.tests.data</code> can not be
27 *  be opened.
28 *
29 * @author    Thomas Aglassinger
30 */
31public final class BrokenComicArchiveTest extends AbstractComicArchiveTest
32{
33    private static Logger logger = Logger.getLogger(BrokenComicArchiveTest.class);
34    private File archive;
35 
36    private BrokenComicArchiveTest(File newArchive) {
37        super();
38        assert newArchive != null;
39        setName("testBrokenArchive");
40        archive = newArchive;
41    }
42 
43    public static Test suite() {
44        TestSuite suite = new TestSuite();
45        TestTools testTools = TestTools.instance();
46        File[] archives = testTools.getTestFiles("^(broken).*\\.(cbz|cbr)$");
47 
48        for (int i = 0; i < archives.length; i += 1) {
49            suite.addTest(new BrokenComicArchiveTest(archives[i]));
50        }
51        return suite;
52    }
53 
54    public void testBrokenArchive()
55        throws Exception {
56        try {
57            testExtract(archive);
58            if (!archive.getName().startsWith("broken_image_")) {
59                fail("archive must be recognized as broken: \"" + archive + "\"");
60            }
61        } catch (Exception error) {
62            logger.debug("ignoring expected exception", error);
63        }
64    }
65}

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