EMMA Coverage Report (generated Fri Jul 28 01:51:09 CEST 2006)
[all classes][org.jtiger.report.html]

COVERAGE SUMMARY FOR SOURCE FILE [IndexHtmlFileWriterFactory.java]

nameclass, %method, %block, %line, %
IndexHtmlFileWriterFactory.java100% (2/2)100% (4/4)62%  (70/113)74%  (21,4/29)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class IndexHtmlFileWriterFactory100% (1/1)100% (2/2)100% (7/7)100% (3/3)
IndexHtmlFileWriterFactory (): void 100% (1/1)100% (3/3)100% (2/2)
newIndexHtmlFileWriter (): IndexHtmlFileWriter 100% (1/1)100% (4/4)100% (1/1)
     
class IndexHtmlFileWriterFactory$IndexHtmlFileWriterImpl100% (1/1)100% (2/2)59%  (63/106)71%  (18,4/26)
IndexHtmlFileWriterFactory$IndexHtmlFileWriterImpl (): void 100% (1/1)100% (3/3)100% (2/2)
writeIndexHtmlFile (File): void 100% (1/1)58%  (60/103)68%  (16,4/24)

1/*
2 * JTiger Unit Testing Framework for J2SE 1.5
3 * Copyright (C) 2005 Tony Morris
4 *
5 * This software is licenced under the
6 * Common Public Licence version 1.0
7 * http://www.opensource.org/licenses/cpl1.0.php
8 *
9 * You received a copy of this licence with this software.
10 */
11package org.jtiger.report.html;
12 
13import java.io.File;
14import java.io.FileOutputStream;
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.OutputStream;
18import org.jtiger.framework.FixtureResultsHandlerException;
19 
20final class IndexHtmlFileWriterFactory
21{
22    private IndexHtmlFileWriterFactory()
23    {
24 
25    }
26 
27    static IndexHtmlFileWriter newIndexHtmlFileWriter()
28    {
29        return new IndexHtmlFileWriterImpl();
30    }
31 
32    private static final class IndexHtmlFileWriterImpl implements IndexHtmlFileWriter
33    {
34        IndexHtmlFileWriterImpl()
35        {
36 
37        }
38 
39        public void writeIndexHtmlFile(final File destination) throws FixtureResultsHandlerException
40        {
41            final File f = new File(destination, "index.html");
42 
43            OutputStream out = null;
44 
45            try
46            {
47                out = new FileOutputStream(f);
48                InputStream in = null;
49 
50                try
51                {
52                    in = getClass().getResourceAsStream("/org/jtiger/report/html/index.html");
53                    final byte[] buffer = new byte[4096];
54                    int len;
55 
56                    while((len = in.read(buffer)) != -1)
57                    {
58                        out.write(buffer, 0, len);
59                    }
60                }
61                finally
62                {
63                    if(in != null)
64                    {
65                        try
66                        {
67                            in.close();
68                        }
69                        catch(IOException e)
70                        {
71                            throw new FixtureResultsHandlerException(e.getMessage(), e);
72                        }
73                    }
74                }
75            }
76            catch(IOException e)
77            {
78                throw new FixtureResultsHandlerException(e.getMessage(), e);
79            }
80            finally
81            {
82                if(out != null)
83                {
84                    try
85                    {
86                        out.close();
87                    }
88                    catch(IOException e)
89                    {
90                        throw new FixtureResultsHandlerException(e.getMessage(), e);
91                    }
92                }
93            }            
94        }
95    }
96}

[all classes][org.jtiger.report.html]
EMMA 2.0.5312 (C) Vladimir Roubtsov