Evaluate TestRequestBuilder.CustomFilters also on class, not just on test.#2209
Draft
jan-varecka-signageos-io wants to merge 2 commits intoandroid:mainfrom
Draft
Conversation
brettchabot
reviewed
May 1, 2024
Collaborator
brettchabot
left a comment
There was a problem hiding this comment.
Can you also add an entry to runner/android_junit_runner/CHANGELOG.md
consp1racy
suggested changes
May 1, 2024
consp1racy
left a comment
There was a problem hiding this comment.
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.
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.
This annotation shouldn't exist, it's essentially the same as SampleCustomAnnotation, just below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Now
TestRequestBuilder.CustomFiltersdoes not evaluate@CustomFilteron 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
@CustomFilterto 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