KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jgrapht > AllTests


1 /* ==========================================
2  * JGraphT : a free Java graph-theory library
3  * ==========================================
4  *
5  * Project Info: http://jgrapht.sourceforge.net/
6  * Project Creator: Barak Naveh (http://sourceforge.net/users/barak_naveh)
7  *
8  * (C) Copyright 2003-2006, by Barak Naveh and Contributors.
9  *
10  * This library is free software; you can redistribute it and/or modify it
11  * under the terms of the GNU Lesser General Public License as published by
12  * the Free Software Foundation; either version 2.1 of the License, or
13  * (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful, but
16  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
17  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
18  * License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public License
21  * along with this library; if not, write to the Free Software Foundation,
22  * Inc.,
23  * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
24  */

25 /* -------------
26  * AllTests.java
27  * -------------
28  * (C) Copyright 2003-2006, by Barak Naveh and Contributors.
29  *
30  * Original Author: Barak Naveh
31  * Contributor(s): -
32  *
33  * $Id: AllTests.java 504 2006-07-03 02:37:26Z perfecthash $
34  *
35  * Changes
36  * -------
37  * 24-Jul-2003 : Initial revision (BN);
38  *
39  */

40 package org.jgrapht;
41
42 import java.util.*;
43
44 import junit.framework.*;
45
46 import org.jgrapht.alg.*;
47 import org.jgrapht.generate.*;
48 import org.jgrapht.graph.*;
49 import org.jgrapht.traverse.*;
50 import org.jgrapht.util.*;
51
52
53 /**
54  * Runs all unit tests of the JGraphT library.
55  *
56  * @author Barak Naveh
57  */

58 public final class AllTests
59 {
60
61     //~ Constructors ----------------------------------------------------------
62

63     private AllTests()
64     {
65     } // ensure non-instantiability.
66

67     //~ Methods ---------------------------------------------------------------
68

69     /**
70      * Creates a test suite that includes all JGraphT tests.
71      *
72      * @return a test suite that includes all JGraphT tests.
73      */

74     public static Test suite()
75     {
76         ExpandableTestSuite suite =
77             new ExpandableTestSuite("All tests of JGraphT");
78
79         suite.addTestSuit((TestSuite) AllAlgTests.suite());
80         suite.addTestSuit((TestSuite) AllGenerateTests.suite());
81         suite.addTestSuit((TestSuite) AllGraphTests.suite());
82         suite.addTestSuit((TestSuite) AllTraverseTests.suite());
83         suite.addTestSuit((TestSuite) AllUtilTests.suite());
84
85         return suite;
86     }
87
88     //~ Inner Classes ---------------------------------------------------------
89

90     private static class ExpandableTestSuite
91         extends TestSuite
92     {
93         /**
94          * @see TestSuite#TestSuite()
95          */

96         public ExpandableTestSuite()
97         {
98             super();
99         }
100
101         /**
102          * @see TestSuite#TestSuite(java.lang.String)
103          */

104         public ExpandableTestSuite(String JavaDoc name)
105         {
106             super(name);
107         }
108
109         /**
110          * Adds all the test from the specified suite into this suite.
111          *
112          * @param suite
113          */

114         public void addTestSuit(TestSuite suite)
115         {
116             for (Enumeration e = suite.tests(); e.hasMoreElements();) {
117                 Test t = (Test) e.nextElement();
118                 this.addTest(t);
119             }
120         }
121     }
122 }
123
Popular Tags