Clover coverage report - Dependency Finder
Coverage timestamp: Mon Nov 29 2010 15:00:50 PST
file stats: LOC: 100   Methods: 5
NCLOC: 52   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
FitTest.java 50% 92.3% 100% 90.9%
coverage coverage
 1    /*
 2    * Copyright (c) 2001-2009, Jean Tessier
 3    * All rights reserved.
 4    *
 5    * Redistribution and use in source and binary forms, with or without
 6    * modification, are permitted provided that the following conditions
 7    * are met:
 8    *
 9    * * Redistributions of source code must retain the above copyright
 10    * notice, this list of conditions and the following disclaimer.
 11    *
 12    * * Redistributions in binary form must reproduce the above copyright
 13    * notice, this list of conditions and the following disclaimer in the
 14    * documentation and/or other materials provided with the distribution.
 15    *
 16    * * Neither the name of Jean Tessier nor the names of his contributors
 17    * may be used to endorse or promote products derived from this software
 18    * without specific prior written permission.
 19    *
 20    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 21    * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 22    * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 23    * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
 24    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 25    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 26    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 27    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 28    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 29    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 30    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 31    */
 32   
 33    package com.jeantessier.fit;
 34   
 35    import java.io.*;
 36    import java.util.*;
 37   
 38    import junit.framework.*;
 39   
 40    import fit.*;
 41   
 42    public class FitTest extends TestCase {
 43    private File inFile;
 44    private File outFile;
 45   
 46    private Fixture fixture;
 47    private String input;
 48    private PrintWriter output;
 49   
 50  77 public FitTest(String name, File inDir, File outDir) {
 51  77 super(name);
 52   
 53  77 inFile = new File(inDir, name);
 54  77 outFile = new File(outDir, name);
 55    }
 56   
 57  77 protected void setUp() throws Exception {
 58  77 super.setUp();
 59   
 60  77 fixture = new Fixture();
 61  77 fixture.summary.put("input file", inFile.getAbsolutePath());
 62  77 fixture.summary.put("input update", new Date(inFile.lastModified()));
 63  77 fixture.summary.put("output file", outFile.getAbsolutePath());
 64   
 65  77 input = read(inFile);
 66   
 67  77 output = new PrintWriter(new BufferedWriter(new FileWriter(outFile)));
 68    }
 69   
 70  77 protected void tearDown() throws Exception {
 71  77 try {
 72  77 output.close();
 73    } finally {
 74  77 super.tearDown();
 75    }
 76    }
 77   
 78  77 protected void runTest() throws Throwable {
 79  77 Parse tables;
 80   
 81  77 if (input.indexOf("<wiki>") >= 0) {
 82  0 tables = new Parse(input, new String[]{"wiki", "table", "tr", "td"});
 83  0 fixture.doTables(tables.parts);
 84    } else {
 85  77 tables = new Parse(input, new String[]{"table", "tr", "td"});
 86  77 fixture.doTables(tables);
 87    }
 88  77 tables.print(output);
 89   
 90  77 assertEquals("count wrongs(" + fixture.counts.wrong + ") + exceptions(" + fixture.counts.exceptions + ")", 0, fixture.counts.wrong + fixture.counts.exceptions);
 91    }
 92   
 93  77 private String read(File input) throws IOException {
 94  77 char chars[] = new char[(int) (input.length())];
 95  77 FileReader in = new FileReader(input);
 96  77 in.read(chars);
 97  77 in.close();
 98  77 return new String(chars);
 99    }
 100    }