001 /* 002 Copyright (C) 2000 Chr. Clemens Lee <clemens@kclee.com>. 003 004 This file is part of JavaNCSS 005 (http://www.kclee.com/clemens/java/javancss/). 006 007 JavaNCSS is free software; you can redistribute it and/or modify it 008 under the terms of the GNU General Public License as published by the 009 Free Software Foundation; either version 2, or (at your option) any 010 later version. 011 012 JavaNCSS is distributed in the hope that it will be useful, but WITHOUT 013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 014 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 015 for more details. 016 017 You should have received a copy of the GNU General Public License 018 along with JavaNCSS; see the file COPYING. If not, write to 019 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 020 Boston, MA 02111-1307, USA. */ 021 022 package javancss.test; 023 024 import java.io.File; 025 026 import ccl.util.Test; 027 028 /** 029 * Base JavaNCSS unit-tests class. 030 * 031 * @author Herv? Boutemy 032 * @version $Id: AbstractTest.java 121 2009-01-17 22:19:45Z hboutemy $ 033 */ 034 public abstract class AbstractTest extends Test 035 { 036 private File testDir = null; 037 038 public void setTestDir( File testDir_ ) 039 { 040 testDir = testDir_; 041 } 042 043 public File getTestDir() 044 { 045 return testDir; 046 } 047 048 protected File getTestFile( String filename ) 049 { 050 return new File( testDir, filename ); 051 } 052 053 protected File getTestFile( int testFileId ) 054 { 055 return getTestFile( "Test" + testFileId + ".java" ); 056 } 057 058 protected AbstractTest() 059 { 060 super(); 061 } 062 063 protected AbstractTest( Test pTest_ ) 064 { 065 super( pTest_ ); 066 } 067 068 public void main() 069 { 070 main( new File( "." ) ); 071 } 072 073 public void main( File baseDir ) 074 { 075 setTestDir( new File( baseDir, "test" ) ); 076 setVerbose( true ); 077 setTiming ( true ); 078 run(); 079 printResult(); 080 } 081 }