< 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,13 +61,13 @@
getListAllJunitTestCases();
if (tests == null) {
return Status.failed("No test cases found in test.");
}
- Iterator iterator = ((Set)tests.entrySet()).iterator();
+ Iterator<Map.Entry<String, Method>> iterator = tests.entrySet().iterator();
while (iterator.hasNext()) {
- Method method = (Method)((Map.Entry)iterator.next()).getValue();
+ Method method = iterator.next().getValue();
Status status = null;
try {
status = invokeTestCase(method);
} catch (Throwable e) {
printStackTrace(e);
@@ -93,11 +93,11 @@
* Entry point for standalone mode.
*/
protected void setup(String executeClass) {
TestCase test;
try {
- Class tc = getClassLoader().loadClass(executeClass);
+ 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,12 +142,12 @@
});
for (Method m: methods){
if(m == null || excludeTestCases.contains(m.getName())){
continue;
}
- Class[] paramTypes = m.getParameterTypes();
- Class returnType = m.getReturnType();
+ 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,7 +159,7 @@
protected TestCase testCaseClass;
protected SortedMap <String, Method> tests;
protected String testCases[] = null;
- protected Vector excludeTestCases = new Vector();
+ protected Vector<String> excludeTestCases = new Vector<>();
}
< prev index next >