< prev index next >
src/com/sun/javatest/junit/JUnitBareMultiTest.java
Print this page
rev 145 : 7902237: Fixing raw use of parameterized class
Reviewed-by: jjg
*** 61,73 ****
getListAllJunitTestCases();
if (tests == null) {
return Status.failed("No test cases found in test.");
}
! Iterator iterator = ((Set)tests.entrySet()).iterator();
while (iterator.hasNext()) {
! Method method = (Method)((Map.Entry)iterator.next()).getValue();
Status status = null;
try {
status = invokeTestCase(method);
} catch (Throwable e) {
printStackTrace(e);
--- 61,73 ----
getListAllJunitTestCases();
if (tests == null) {
return Status.failed("No test cases found in test.");
}
! Iterator<Map.Entry<String, Method>> iterator = tests.entrySet().iterator();
while (iterator.hasNext()) {
! Method method = iterator.next().getValue();
Status status = null;
try {
status = invokeTestCase(method);
} catch (Throwable e) {
printStackTrace(e);
*** 93,103 ****
* Entry point for standalone mode.
*/
protected void setup(String executeClass) {
TestCase test;
try {
! Class tc = getClassLoader().loadClass(executeClass);
String name = tc.getName();
String constructor = tc.getConstructors()[0].toGenericString();
test = (constructor.indexOf("java.lang.String") > -1)?
(TestCase)tc.getConstructors()[0].newInstance(new Object[] {name}):
(TestCase)tc.newInstance();
--- 93,103 ----
* Entry point for standalone mode.
*/
protected void setup(String executeClass) {
TestCase test;
try {
! Class<?> tc = getClassLoader().loadClass(executeClass);
String name = tc.getName();
String constructor = tc.getConstructors()[0].toGenericString();
test = (constructor.indexOf("java.lang.String") > -1)?
(TestCase)tc.getConstructors()[0].newInstance(new Object[] {name}):
(TestCase)tc.newInstance();
*** 142,153 ****
});
for (Method m: methods){
if(m == null || excludeTestCases.contains(m.getName())){
continue;
}
! Class[] paramTypes = m.getParameterTypes();
! Class returnType = m.getReturnType();
String name = m.getName();
if ((paramTypes.length == 0) &&
Void.TYPE.isAssignableFrom(returnType) && name.startsWith("test") ) {
tests.put(name, m);
}
--- 142,153 ----
});
for (Method m: methods){
if(m == null || excludeTestCases.contains(m.getName())){
continue;
}
! Class<?>[] paramTypes = m.getParameterTypes();
! Class<?> returnType = m.getReturnType();
String name = m.getName();
if ((paramTypes.length == 0) &&
Void.TYPE.isAssignableFrom(returnType) && name.startsWith("test") ) {
tests.put(name, m);
}
*** 159,165 ****
protected TestCase testCaseClass;
protected SortedMap <String, Method> tests;
protected String testCases[] = null;
! protected Vector excludeTestCases = new Vector();
}
--- 159,165 ----
protected TestCase testCaseClass;
protected SortedMap <String, Method> tests;
protected String testCases[] = null;
! protected Vector<String> excludeTestCases = new Vector<>();
}
< prev index next >