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
diff --git a/README.google b/README.google
index ac1b328..3f85ec8 100644
--- a/README.google
+++ b/README.google
@@ -13,3 +13,4 @@
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 @@
@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);
}