aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2017-03-22 15:52:14 +0000
committerPaul Duffin <paulduffin@google.com>2017-03-22 16:39:53 +0000
commit99fe7c3891c8a9600d9b568ff50f3e25863d6108 (patch)
tree949e76c140c6b5415b519eaf577c12dc8d704b14
parentea07fbcef796fdacd3110b41eec7a6c6e55044fc (diff)
downloadjunit-params-99fe7c3891c8a9600d9b568ff50f3e25863d6108.tar.gz
Make sure that filters affect the Description
JUnitParamsRunner caches the Description on first request but if that happens before applying a filter then the Description never gets updated. This fixes the problem by discarding the cached Description forcing it to be regenerated next time it is requested. Bug: 36074730 Test: run cts -a arm64-v8a -m CtsLibcoreTestCases -t libcore.java.net.InetAddressTest#test_isReachable_by_ICMP Change-Id: Ibc35c013c388f81fd5b69c553b167e3d11af6841
-rw-r--r--README.google1
-rw-r--r--src/main/java/junitparams/JUnitParamsRunner.java3
2 files changed, 4 insertions, 0 deletions
diff --git a/README.google b/README.google
index ac1b328..3f85ec8 100644
--- a/README.google
+++ b/README.google
@@ -13,3 +13,4 @@ Local Modifications:
java.beans.PropertyEditor and
java.beans.PropertyEditorManager classes by
removing the usages of them.
+ 36074730 - Make sure that filters affect the Description.
diff --git a/src/main/java/junitparams/JUnitParamsRunner.java b/src/main/java/junitparams/JUnitParamsRunner.java
index fa37257..970529e 100644
--- a/src/main/java/junitparams/JUnitParamsRunner.java
+++ b/src/main/java/junitparams/JUnitParamsRunner.java
@@ -397,6 +397,9 @@ public class JUnitParamsRunner extends BlockJUnit4ClassRunner {
@Override
public void filter(Filter filter) throws NoTestsRemainException {
super.filter(filter);
+ // Android-changed: Applying a filter could change the description so invalidate any cached
+ // description. See b/36074730
+ description = null;
this.parametrizedTestMethodsFilter = new ParametrizedTestMethodsFilter(this,filter);
}