-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Evaluate TestRequestBuilder.CustomFilters also on class, not just on test. #2209
base: main
Are you sure you want to change the base?
Evaluate TestRequestBuilder.CustomFilters also on class, not just on test. #2209
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add an entry to runner/android_junit_runner/CHANGELOG.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm missing a test case where the annotation is both on the class and on the methods, with different values.
true { true, false, none } --> 2
public void testTwoSkip() {} | ||
} | ||
|
||
public static class SampleCustomFilterOnClass extends AbstractFilter { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test code esentially simulates consumer code. The consumer shouldn't need to override anything but evaluateTest
for this PR to work on classes. And they don't, thanks to the changes in CustomFilters.shouldRun
above.
This class shouldn't exist. Usages can be replaced by the existing SampleCustomFilter
class.
@Retention(RetentionPolicy.RUNTIME) | ||
@Target({ElementType.TYPE}) | ||
@CustomFilter(filterClass = SampleCustomFilterOnClass.class) | ||
public @interface SampleCustomAnnotationOnClass { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This annotation shouldn't exist, it's essentially the same as SampleCustomAnnotation
, just below.
Now
TestRequestBuilder.CustomFilters
does not evaluate@CustomFilter
on test classes, just on tests. It will be great to have evaluation also for classes.Because of this missing feature, I need to apply my annotation with
@CustomFilter
to every test method, or I have to configure instrumentation runner in build.gradle.kts (or in my custom runner). All these solutions are kind of painful in large multimodule project.or