1   package com.mccrory.scott.spumoni.test;
2   
3   ////////////////////////////////////////////////////////////////////////////////
4   // Copyright (C) 2002  Scott McCrory
5   //
6   // This program is free software; you can redistribute it and/or
7   // modify it under the terms of the GNU General Public License
8   // as published by the Free Software Foundation; either version 2
9   // of the License, or (at your option) any later version.
10  //
11  // This program is distributed in the hope that it will be useful,
12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  // GNU General Public License for more details.
15  //
16  // You should have received a copy of the GNU General Public License
17  // along with this program; if not, write to the Free Software
18  // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19  ////////////////////////////////////////////////////////////////////////////////
20  
21  import junit.framework.TestCase;
22  
23  import com.mccrory.scott.spumoni.StatsCollector;
24  
25  /**
26   * <P>JUnit test case for the StatsCollector class.</P>
27   *
28   * @author <a href="mailto:smccrory@users.sourceforge.net">Scott McCrory</a>.
29   * @version CVS $Id: StatsCollectorTest.java,v 1.2 2002/08/04 22:04:53 smccrory Exp $
30   */
31  public class StatsCollectorTest extends TestCase {
32  
33      /** A class-wide storage container for the command-line arguments **/
34      private static String[] myargs;
35  
36      /**
37       * StatsCollectorTest constructor
38       * @param name java.lang.String
39       */
40      public StatsCollectorTest(String name) {
41          super(name);
42      }
43      
44      /**
45       * Runs the JUnit test from the command line.
46       * @param args java.lang.String[]
47       */
48      public static void main(String[] args) {
49  
50          myargs = args;
51          junit.textui.TestRunner.run(StatsCollectorTest.class);
52  
53      }
54      
55      /**
56       * Tests the StatsCollector operations.
57       * Creation date: (1/12/2002 7:22:47 PM)
58       */
59      public void testCollectStats() {
60  
61          try {
62  
63              // Contruct the StatsCollector and make sure
64              // we can parse the command line and the XML files
65              StatsCollector sc = new StatsCollector(myargs);
66              assertNotNull("StatsCollector must not be null", sc);
67  
68              // Run the stats collector once and make sure it worked.
69              //sc.collectStats();
70              //assertNotNull(sc.getCollectedStats());
71  
72          }
73          catch (Exception e) {
74              e.printStackTrace();
75              fail("Should not encounter " + e.getMessage());
76          }
77  
78      }
79      
80  }