Skip to content
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

Add repeatable capabilities for @..Source annotations #3787

Open
wants to merge 20 commits into
base: main
Choose a base branch
from

Conversation

madalingiurca
Copy link

@madalingiurca madalingiurca commented Apr 18, 2024

Overview

These changes aim to add capabilities of repeatable @..Source annotations. Solves #3736.
Repeatable capabilities added to every annotation that makes use of AnnotationBasedArgumentsProvider by adapting to accept multiple annotations while aggregating the result of each annotation arguments.

Helper class AnnotationConsumerInitializer needs adaptations as well in order to invoke initialization for each annotation if repeatable.

This change does not affect annotations related to null and/or empty sources: @NullSource, @EmptySource and @NullAndEmptySource. This makes sense since they have predefined/hardcoded arguments relevant to null and empty collections.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

Copy link
Member

@marcphilipp marcphilipp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks promising! 👍

Copy link
Member

@marcphilipp marcphilipp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm really looking forward to getting this merged!

@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@API(status = STABLE, since = "5.11")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be experimental like @FieldSource

Suggested change
@API(status = STABLE, since = "5.11")
@API(status = EXPERIMENTAL, since = "5.11")

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, true. Changed it to experimental in 7a0f7f1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should change the first sentence of the Javadoc here and for the other source annotation to mention that they're repeatable:

 * {@code @CsvFileSource} is a {@linkplain Repeatable repeatable}
 * {@link ArgumentsSource} which is used to load comma-separated value (CSV)
 * files from one or more classpath {@link #resources} or {@link #files}.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. Repeatable mention added for all 6 changed annotations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support @EnumSource, @CsvSource, etc. as repeatable annotations
2 participants