KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sourceforge > groboutils > junit > v1 > parser > ITestCreator


1 /*
2  * @(#)ITestCreator.java
3  *
4  * Copyright (C) 2002-2003 Matt Albrecht
5  * groboclown@users.sourceforge.net
6  * http://groboutils.sourceforge.net
7  *
8  * Permission is hereby granted, free of charge, to any person obtaining a
9  * copy of this software and associated documentation files (the "Software"),
10  * to deal in the Software without restriction, including without limitation
11  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12  * and/or sell copies of the Software, and to permit persons to whom the
13  * Software is furnished to do so, subject to the following conditions:
14  *
15  * The above copyright notice and this permission notice shall be included in
16  * all copies or substantial portions of the Software.
17  *
18  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24  * DEALINGS IN THE SOFTWARE.
25  */

26
27 package net.sourceforge.groboutils.junit.v1.parser;
28
29 import java.lang.reflect.Method JavaDoc;
30 import java.lang.reflect.InvocationTargetException JavaDoc;
31
32 import junit.framework.Test;
33
34
35 /**
36  * Interface that can create test objects based on a class and a method from
37  * within that class, using a specific method. Also provides means to check
38  * the class object to see if the implementation can instantiate the test
39  * class.
40  *
41  * @author Matt Albrecht <a HREF="mailto:groboclown@users.sourceforge.net">groboclown@users.sourceforge.net</a>
42  * @version $Date: 2003/02/10 22:52:21 $
43  * @since November 3, 2002
44  */

45 public interface ITestCreator
46 {
47     /**
48      * Creates a new test, based on the given class and method of the
49      * class.
50      *
51      * @param theClass the class to parse for testing.
52      * @param m the method that will be tested with the new class instance.
53      * @return the generated test, or <tt>null</tt> if the test could not
54      * be created.
55      * @exception InstantiationException if there was a problem creating
56      * the class.
57      * @exception NoSuchMethodException if the method does not exist in the
58      * class.
59      */

60     public Test createTest( Class JavaDoc theClass, Method JavaDoc method )
61             throws InstantiationException JavaDoc, NoSuchMethodException JavaDoc,
62             InvocationTargetException JavaDoc, IllegalAccessException JavaDoc,
63             ClassCastException JavaDoc;
64     
65     /**
66      * Checks if the creator can be used on the given class.
67      *
68      * @param theClass the class to check if parsing is acceptable.
69      * @return whether the creator can generate a test based on
70      * <tt>theClass</tt>.
71      */

72     public boolean canCreate( Class JavaDoc theClass );
73 }
74
75
Popular Tags