aboutsummaryrefslogtreecommitdiffstats
path: root/tests/junit-runner
diff options
context:
space:
mode:
authorJiri Vanek <[email protected]>2013-12-13 09:54:16 +0100
committerJiri Vanek <[email protected]>2013-12-13 09:54:16 +0100
commit6256aac59275df0edd0feb4950272aa33573be9f (patch)
treeadba1e61360cf9e18597a8736b8c50b5022605a0 /tests/junit-runner
parent26e9ef073e4ba4e625c8596113e9138ec85162e4 (diff)
unittests warning cleanup: fixed typechecks, rawtypes, redundant casts...
ScreenFinder fixed to work partially also in headless mode. After this clean up only "internal proprietary API and may be removed in a future release" warnings remain fro make check. Please keep itw in this way :)
Diffstat (limited to 'tests/junit-runner')
-rw-r--r--tests/junit-runner/CommandLine.java2
-rw-r--r--tests/junit-runner/JunitLikeXmlOutputListener.java8
-rw-r--r--tests/junit-runner/LessVerboseTextListener.java11
3 files changed, 12 insertions, 9 deletions
diff --git a/tests/junit-runner/CommandLine.java b/tests/junit-runner/CommandLine.java
index 07c6e19..52843e5 100644
--- a/tests/junit-runner/CommandLine.java
+++ b/tests/junit-runner/CommandLine.java
@@ -45,7 +45,7 @@ public class CommandLine extends JUnitCore {
addListener(jXmlOutput);
RunListener listener = new LessVerboseTextListener(system);
addListener(listener);
- Result result = run(classes.toArray(new Class[0]));
+ Result result = run(classes.toArray(new Class<?>[0]));
for (Failure each : missingClasses) {
result.getFailures().add(each);
}
diff --git a/tests/junit-runner/JunitLikeXmlOutputListener.java b/tests/junit-runner/JunitLikeXmlOutputListener.java
index 5e39cf6..c395dca 100644
--- a/tests/junit-runner/JunitLikeXmlOutputListener.java
+++ b/tests/junit-runner/JunitLikeXmlOutputListener.java
@@ -80,7 +80,7 @@ public class JunitLikeXmlOutputListener extends RunListener {
private class ClassStat {
- Class c;
+ Class<?> c;
int total;
int failed;
int passed;
@@ -178,8 +178,9 @@ public class JunitLikeXmlOutputListener extends RunListener {
}
+ @SuppressWarnings("unchecked")
private void testDone(Description description, long testTime, double testTimeSeconds, boolean ignored) throws Exception {
- Class testClass = null;
+ Class<?> testClass = null;
Method testMethod = null;
try {
testClass = description.getTestClass();
@@ -305,6 +306,7 @@ public class JunitLikeXmlOutputListener extends RunListener {
}
@Override
+ @SuppressWarnings("unchecked")
public void testRunFinished(Result result) throws Exception {
writeElement(SOUT_ELEMENT, "@sout@");
@@ -335,7 +337,7 @@ public class JunitLikeXmlOutputListener extends RunListener {
try {
Bug b = null;
if (entry.getValue().c != null) {
- b = (Bug) entry.getValue().c.getAnnotation(Bug.class);
+ b = entry.getValue().c.getAnnotation(Bug.class);
}
if (b != null) {
openElement(BUGS);
diff --git a/tests/junit-runner/LessVerboseTextListener.java b/tests/junit-runner/LessVerboseTextListener.java
index 34df9f3..6f8a7df 100644
--- a/tests/junit-runner/LessVerboseTextListener.java
+++ b/tests/junit-runner/LessVerboseTextListener.java
@@ -114,11 +114,12 @@ public class LessVerboseTextListener extends RunListener {
}
}
-
- public static <T extends Annotation> T getAnnotation(Class q, String methodName, Class<T> a) {
+
+ @SuppressWarnings("unchecked")
+ public static <T extends Annotation> T getAnnotation(Class<?> q, String methodName, Class<T> a) {
try {
if (q != null) {
- T rem = (T) q.getAnnotation(a);
+ T rem = q.getAnnotation(a);
if (rem != null) {
return rem;
}
@@ -140,11 +141,11 @@ public class LessVerboseTextListener extends RunListener {
}
public static KnownToFail getK2F(Description description) {
- return (KnownToFail) getAnnotation(description.getTestClass(), description.getMethodName(), KnownToFail.class);
+ return getAnnotation(description.getTestClass(), description.getMethodName(), KnownToFail.class);
}
public static Remote getRemote(Description description) {
- return (Remote) getAnnotation(description.getTestClass(), description.getMethodName(), Remote.class);
+ return getAnnotation(description.getTestClass(), description.getMethodName(), Remote.class);
}