1 /*
2 Copyright (C) 2000 Chr. Clemens Lee <clemens@kclee.com>.
3
4 This file is part of JavaNCSS
5 (http://www.kclee.com/clemens/java/javancss/).
6
7 JavaNCSS is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by the
9 Free Software Foundation; either version 2, or (at your option) any
10 later version.
11
12 JavaNCSS is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with JavaNCSS; see the file COPYING. If not, write to
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
21
22 package javancss.test;
23
24 import java.io.File;
25
26 import ccl.util.Test;
27
28 /**
29 * Base JavaNCSS unit-tests class.
30 *
31 * @author Hervé Boutemy
32 * @version $Id: AbstractTest.java 121 2009-01-17 22:19:45Z hboutemy $
33 */
34 public abstract class AbstractTest extends Test
35 {
36 private File testDir = null;
37
38 public void setTestDir( File testDir_ )
39 {
40 testDir = testDir_;
41 }
42
43 public File getTestDir()
44 {
45 return testDir;
46 }
47
48 protected File getTestFile( String filename )
49 {
50 return new File( testDir, filename );
51 }
52
53 protected File getTestFile( int testFileId )
54 {
55 return getTestFile( "Test" + testFileId + ".java" );
56 }
57
58 protected AbstractTest()
59 {
60 super();
61 }
62
63 protected AbstractTest( Test pTest_ )
64 {
65 super( pTest_ );
66 }
67
68 public void main()
69 {
70 main( new File( "." ) );
71 }
72
73 public void main( File baseDir )
74 {
75 setTestDir( new File( baseDir, "test" ) );
76 setVerbose( true );
77 setTiming ( true );
78 run();
79 printResult();
80 }
81 }