< prev index next >
src/com/sun/javatest/lib/TestCases.java
Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg
*** 136,154 ****
/**
* Return an enumeration of the selected test cases, based on the
* select and exclude calls that have been made, if any.
* @return An enumeration of the test cases.
*/
! public Enumeration enumerate() {
Vector<Method> v = new Vector<>();
if (selectedCases.isEmpty()) {
Method[] methods = testClass.getMethods();
for (int i = 0; i < methods.length; i++) {
Method m = methods[i];
if (excludedCases.get(m.getName()) == null) {
! Class[] paramTypes = m.getParameterTypes();
! Class returnType = m.getReturnType();
if ((paramTypes.length == 0) && Status.class.isAssignableFrom(returnType))
v.addElement(m);
}
}
}
--- 136,154 ----
/**
* Return an enumeration of the selected test cases, based on the
* select and exclude calls that have been made, if any.
* @return An enumeration of the test cases.
*/
! public Enumeration<Method> enumerate() {
Vector<Method> v = new Vector<>();
if (selectedCases.isEmpty()) {
Method[] methods = testClass.getMethods();
for (int i = 0; i < methods.length; i++) {
Method m = methods[i];
if (excludedCases.get(m.getName()) == null) {
! Class<?>[] paramTypes = m.getParameterTypes();
! Class<?> returnType = m.getReturnType();
if ((paramTypes.length == 0) && Status.class.isAssignableFrom(returnType))
v.addElement(m);
}
}
}
*** 174,194 ****
*/
public Status invokeTestCases() {
// see if test object provides Status invokeTestCase(Method m)
Method invoker;
try {
! invoker = testClass.getMethod("invokeTestCase", new Class[] {Method.class});
if (!Status.class.isAssignableFrom(invoker.getReturnType()))
invoker = null;
}
catch (NoSuchMethodException e) {
invoker = null;
}
MultiStatus ms = new MultiStatus(log);
! for (Enumeration e = enumerate(); e.hasMoreElements(); ) {
! Method m = (Method)(e.nextElement());
Status s;
try {
if (invoker != null)
s = (Status)invoker.invoke(test, new Object[] {m});
else
--- 174,194 ----
*/
public Status invokeTestCases() {
// see if test object provides Status invokeTestCase(Method m)
Method invoker;
try {
! invoker = testClass.getMethod("invokeTestCase", new Class<?>[] {Method.class});
if (!Status.class.isAssignableFrom(invoker.getReturnType()))
invoker = null;
}
catch (NoSuchMethodException e) {
invoker = null;
}
MultiStatus ms = new MultiStatus(log);
! for (Enumeration<Method> e = enumerate(); e.hasMoreElements(); ) {
! Method m = (e.nextElement());
Status s;
try {
if (invoker != null)
s = (Status)invoker.invoke(test, new Object[] {m});
else
*** 269,275 ****
private Map<String, Method> selectedCases = new Hashtable<>();
private Map<String, Method> excludedCases = new Hashtable<>();
private PrintWriter log;
private static final Object[] noArgs = { };
! private static final Class[] noArgTypes = { };
}
--- 269,275 ----
private Map<String, Method> selectedCases = new Hashtable<>();
private Map<String, Method> excludedCases = new Hashtable<>();
private PrintWriter log;
private static final Object[] noArgs = { };
! private static final Class<?>[] noArgTypes = { };
}
< prev index next >