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

COVERAGE SUMMARY FOR SOURCE FILE [CreateZipArchiveTaskTest.java]

nameclass, %method, %block, %line, %
CreateZipArchiveTaskTest.java100% (1/1)100% (2/2)95%  (109/115)100% (21.9/22)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CreateZipArchiveTaskTest100% (1/1)100% (2/2)95%  (109/115)100% (21.9/22)
testCreateZipArchiveTask (): void 100% (1/1)95%  (106/112)100% (20.9/21)
CreateZipArchiveTaskTest (): void 100% (1/1)100% (3/3)100% (1/1)

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;
19import java.io.IOException;
20 
21import junit.framework.TestCase;
22import net.sf.jomic.tools.FileTools;
23import net.sf.jomic.tools.TestTools;
24 
25/**
26 *  TestCase for CreateZipArchiveTask.
27 *
28 * @author    Thomas Aglassinger
29 */
30public class CreateZipArchiveTaskTest extends TestCase
31{
32    public void testCreateZipArchiveTask()
33        throws IOException {
34        TestTools testTools = TestTools.instance();
35        FileTools fileTools = FileTools.instance();
36        String targetZipName = testTools.getTestFileName(
37                CreateZipArchiveTaskTest.class, "testCreateZipArchiveTask", null, "zip");
38        File targetZipFile = testTools.getTestOutputFile(targetZipName);
39        String sourceBaseDirName = testTools.getTestFileName(
40                CreateZipArchiveTaskTest.class, "testCreateZipArchiveTask", null, null);
41        File sourceBaseDir = testTools.getTestInputFile(sourceBaseDirName);
42        File sourceBaseSubDir = new File(sourceBaseDir, "subDir");
43        File testImageFile = testTools.getTestImageFile();
44        String testImageName = testImageFile.getName();
45        File imageInRootDirFile = new File(sourceBaseDir, testImageName);
46        File imageInSubDirFile = new File(sourceBaseSubDir, testImageName);
47 
48        fileTools.mkdirs(sourceBaseSubDir);
49        fileTools.copyFile(testImageFile, imageInRootDirFile);
50        fileTools.copyFile(testImageFile, imageInSubDirFile);
51 
52        String[] sourceFileNames = new String[]{
53                fileTools.getRelativePath(sourceBaseDir, imageInRootDirFile),
54                fileTools.getRelativePath(sourceBaseDir, imageInSubDirFile)
55                };
56        CreateZipArchiveTask zipTask = new CreateZipArchiveTask(targetZipFile, sourceBaseDir, sourceFileNames);
57 
58        targetZipFile.delete();
59        assertFalse(targetZipFile.exists());
60        zipTask.start();
61        assertTrue(targetZipFile.exists());
62    }
63}

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