Source code: org/finj/test/FinjTestCase.java
1 package org.finj.test;
2
3 import java.io.IOException;
4
5 import junit.framework.Test;
6 import junit.framework.TestCase;
7
8 /**
9 * Mother of all other test classes, that offers the basic launcheable
10 * functionalities.
11 *
12 * Copyright (C)
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 *
28 * @author Javier Iglesias -- jiglesias@users.sourceforge.net
29 * @version $Id: FinjTestCase.java,v 1.3 2003/10/22 08:26:26 jiglesia Exp $
30 * @since v1.0.2
31 */
32 public class FinjTestCase extends TestCase {
33
34 protected FTPClientTest client = null;
35
36 /**
37 *
38 *
39 * @since v1.0.2
40 */
41 public FinjTestCase ( String name ) {
42 super(name);
43 }
44
45 /**
46 *
47 *
48 * @since v1.0.2
49 */
50 protected void setUp ( ) throws IOException {
51 System.err.println("\n\n\n");
52 client = new FTPClientTest();
53 client.open();
54 }
55
56 /**
57 *
58 *
59 * @since v1.0.2
60 */
61 protected void tearDown ( ) throws IOException {
62 client.close();
63 client = null;
64 System.err.println("\n\n\n");
65 }
66
67 /**
68 *
69 *
70 * @since v1.0.2
71 */
72 public void runTestInterface ( String[] args ) {
73 if ( args.length > 0 ) {
74 if ( args[0].equals("-a") ) {
75 // junit.awtui.TestRunner.run(AllTest.class);
76 junit.awtui.TestRunner.run(getClass());
77 return;
78 }
79 if ( args[0].equals("-s") ) {
80 junit.swingui.TestRunner.run(getClass());
81 return;
82 }
83 if ( args[0].equals("-h") ) {
84 System.out.println("Usage : java org.finj.test.AllTest [ [ -t ] | -a | -s | -h ]");
85 System.out.println(" -t : use command-line interface,");
86 System.out.println(" -a : use AWT interface,");
87 System.out.println(" -s : use swing interface,");
88 System.out.println(" -h : prints this help.");
89 return;
90 }
91 }
92 // fall back here !
93 try {
94 junit.textui.TestRunner.run((Test)(getClass().getMethod("suite",null).invoke(this, null)));
95 } catch ( Exception e ) {;}
96 }
97 }