aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2016-08-15 21:01:20 +0000
committerGravatar Philipp Wollermann <philwo@google.com>2016-08-16 15:21:02 +0000
commit20703c2667539202ca8fcbe93ebd9a5450c7e6ab (patch)
treecfa3186d0430246ac5254b5e5d104cb23b78acca
parent6c64081b212ba8ac4ea0ae16ab2e452ef2c0b873 (diff)
Gracefully handle non existing test descriptions
This change is necessary due to recent move away from Guava immutable collections (which returns null in case of non-existing item) to Java native ones (some of which throws exceptions). One such use case where it was breaking the code was tests that uses junitparam, which might be an indication of another problem. -- MOS_MIGRATED_REVID=130321230
-rw-r--r--src/java_tools/junitrunner/java/com/google/testing/junit/runner/model/TestSuiteModel.java6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/model/TestSuiteModel.java b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/model/TestSuiteModel.java
index aeb8949a2c..08be4caeda 100644
--- a/src/java_tools/junitrunner/java/com/google/testing/junit/runner/model/TestSuiteModel.java
+++ b/src/java_tools/junitrunner/java/com/google/testing/junit/runner/model/TestSuiteModel.java
@@ -86,11 +86,13 @@ public class TestSuiteModel {
* listener!
*/
private TestCaseNode getTestCase(Description description) {
- return testCaseMap.get(description);
+ // TODO(cpovirk): Is it legitimate to pass null here?
+ return description == null ? null : testCaseMap.get(description);
}
private TestNode getTest(Description description) {
- return testsMap.get(description);
+ // TODO(cpovirk): Is it legitimate to pass null here?
+ return description == null ? null : testsMap.get(description);
}
// VisibleForTesting