Clover Coverage Report
Coverage timestamp: Sat Sep 18 2010 04:09:52 UTC
../../../../img/srcFileCovDistChart9.png 34% of files have more coverage
14   106   8   2.33
2   42   0.57   6
6     1.33  
1    
 
  QedeqTestCase       Line # 33 14 8 90.9% 0.90909094
 
  (150)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2010, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.base.test;
17   
18    import java.io.File;
19    import java.net.URL;
20   
21    import junit.framework.TestCase;
22   
23    import org.apache.log4j.Level;
24    import org.apache.log4j.Logger;
25    import org.apache.log4j.helpers.Loader;
26    import org.apache.log4j.xml.DOMConfigurator;
27   
28    /**
29    * Basis class for all tests.
30    *
31    * @author Michael Meyling
32    */
 
33    public abstract class QedeqTestCase extends TestCase {
34   
 
35  78 toggle static {
36    // init Log4J watchdog
37  78 try {
38  78 URL url = Loader.getResource("config/log4j.xml");
39  78 if (url != null) {
40    // set properties and watch file every 5 seconds
41  78 DOMConfigurator.configureAndWatch(url.getPath(), 5000);
42    } else {
43  0 Logger.getRootLogger().setLevel(Level.ERROR);
44    }
45    } catch (Exception e) {
46    // we ignore this
47    }
48    }
49   
50    /** Destination directory for generated output files. */
51    private final File outdir;
52   
53    /** Source directory for input files. */
54    private final File indir;
55   
56    /**
57    * Constructor.
58    *
59    * @param name Test case name.
60    */
 
61  129 toggle public QedeqTestCase(final String name) {
62  129 super(name);
63  129 outdir = new File(System.getProperty("qedeq.test.outdir", "../../../qedeq_gen"));
64  129 indir = new File(System.getProperty("qedeq.test.indir", "data"));
65    }
66   
67    /**
68    * Constructor.
69    */
 
70  429 toggle public QedeqTestCase() {
71  429 super();
72  429 outdir = new File(System.getProperty("qedeq.test.outdir", "../../../qedeq_gen"));
73  429 indir = new File(System.getProperty("qedeq.test.indir", "data"));
74    }
75   
76    /**
77    * Get output directory for test output. Might be set initially by setting the system property
78    * <code>qedeq.test.outdir</code>.
79    *
80    * @return Directory for test output.
81    */
 
82  75 toggle public File getOutdir() {
83  75 return outdir;
84    }
85   
86    /**
87    * Get input directory for test input data. Might be set initially by setting the system
88    * property <code>qedeq.test.indir</code>.
89    *
90    * @return Directory for test input.
91    */
 
92  191 toggle public File getIndir() {
93  191 return indir;
94    }
95   
96    /**
97    * Get test input data file. Get file relative to {@link #getIndir()}.
98    *
99    * @param fileName Relative file path.
100    * @return Test data file.
101    */
 
102  82 toggle public File getFile(final String fileName) {
103  82 return new File(getIndir(), fileName);
104    }
105   
106    }