Skip to content

Conversation

vdmitrienko
Copy link
Contributor

@vdmitrienko vdmitrienko commented Oct 6, 2025


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


#5028

Definition of Done

@sbrannen

This comment was marked as outdated.

@vdmitrienko vdmitrienko marked this pull request as ready for review October 11, 2025 11:29
@vdmitrienko
Copy link
Contributor Author

vdmitrienko commented Oct 11, 2025

@vdmitrienko, is this PR "ready for review"?

@sbrannen, I’d like to update the User Guide and Release Notes, but other than that, it’s ready.

UPD

The User Guide and Release Notes updated ✔️

@vdmitrienko
Copy link
Contributor Author

@marcphilipp, @sbrannen, I'm a bit confused 😅 . According to the compatibility scan, this new method is a source-incompatible change, even though it has a default value:

char commentCharacter() default '#';

Could you take a look?

Screenshot 2025-10-11 at 16 22 44

@marcphilipp
Copy link
Member

I'm a bit confused 😅 . According to the compatibility scan, this new method is a source-incompatible change, even though it has a default value

Looks like that's a false-positive reported by japicmp:

I hope that we can switch to roseau soon (see #5010) because it seems to be more precise.

For now, I just pushed a commit adding the two new attributes to the list of "accepted breaking changes" even though we know they're not actually breaking.

* ❓
* A regression introduced in version 6.0.0 caused an exception when using the
`@CsvSource` or `@CsvFileSource` annotations when the `delimiter` or
`delimiterString` attribute was set to #. This occurred because `#` was used
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
`delimiterString` attribute was set to #. This occurred because `#` was used
`delimiterString` attribute was set to `#`. This occurred because `#` was used

@sbrannen
Copy link
Member

New method in annotation with default value reported as METHOD_ABSTRACT_ADDED_TO_CLASS siom79/japicmp#249

Ahhh, good that that's already been reported. 👍

I hope that we can switch to roseau soon (see #5010) because it seems to be more precise.

🤞

For now, I just pushed a commit adding the two new attributes to the list of "accepted breaking changes" even though we know they're not actually breaking.

Oh man... I literally did that at the same time as you (perhaps even before you), but I was away from the computer and came back to find you'd already pushed the same fix. 😆

Though, I sorted the entries alphabetically. 😉

Copy link
Member

@sbrannen sbrannen left a comment

Choose a reason for hiding this comment

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

Looking very good! 👍

I've requested a few minor changes.

Comment on lines 38 to 44
* A regression introduced in version 6.0.0 caused an exception when using the
`@CsvSource` or `@CsvFileSource` annotations when the `delimiter` or
`delimiterString` attribute was set to #. This occurred because `#` was used
as the default comment character without an option to change it.
To resolve this, a new `commentCharacter` attribute has been added to both
annotations. Its default value remains `#`, but it can now be customized
to avoid conflicts with other control characters.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* A regression introduced in version 6.0.0 caused an exception when using the
`@CsvSource` or `@CsvFileSource` annotations when the `delimiter` or
`delimiterString` attribute was set to #. This occurred because `#` was used
as the default comment character without an option to change it.
To resolve this, a new `commentCharacter` attribute has been added to both
annotations. Its default value remains `#`, but it can now be customized
to avoid conflicts with other control characters.
* A regression introduced in version 6.0.0 caused an exception when using `@CsvSource` or
`@CsvFileSource` if the `delimiter` or `delimiterString` attribute was set to `+++#+++`.
This occurred because `+++#+++` was used as the default comment character without an
option to change it. To resolve this, a new `commentCharacter` attribute has been added
to both annotations. Its default value remains `+++#+++`, but it can now be customized
to avoid conflicts with other control characters.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 1 to 2
org.junit.jupiter.params.provider.CsvSource#commentCharacter
org.junit.jupiter.params.provider.CsvFileSource#commentCharacter
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
org.junit.jupiter.params.provider.CsvSource#commentCharacter
org.junit.jupiter.params.provider.CsvFileSource#commentCharacter
org.junit.jupiter.params.provider.CsvFileSource#commentCharacter
org.junit.jupiter.params.provider.CsvSource#commentCharacter

Sort alphabetically.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

*
* <p>Any line beginning with a {@code #} symbol will be interpreted as a comment
* and will be ignored.
* <p>Any line beginning with a {@link #commentCharacter()}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* <p>Any line beginning with a {@link #commentCharacter()}
* <p>Any line beginning with a {@linkplain #commentCharacter() comment character}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sbrannen, what do you think about keeping {@link ...} here for consistency with how the other attributes are described?

Copy link
Member

Choose a reason for hiding this comment

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

No problem. Consistency is king. 👍🏻

* <p>The comment character must be the first character on the line without
* any leading whitespace.
*
* <p>Defaults to a hashtag {@code #}.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* <p>Defaults to a hashtag {@code #}.
* <p>Defaults to {@code '#'}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines 103 to 105
validateControlCharactersDiffer(
delimiter, csvFileSource.quoteCharacter(), csvFileSource.commentCharacter(), commentStrategy
);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
validateControlCharactersDiffer(
delimiter, csvFileSource.quoteCharacter(), csvFileSource.commentCharacter(), commentStrategy
);
validateControlCharactersDiffer(
delimiter, csvFileSource.quoteCharacter(), csvFileSource.commentCharacter(), commentStrategy);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

* <p>The comment character must be the first character on the line without
* any leading whitespace.
*
* <p>Defaults to a hashtag {@code #}.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* <p>Defaults to a hashtag {@code #}.
* <p>Defaults to {@code '#'}.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

? builder.delimiter(c).build() //
: builder.delimiterString(delimiter.toString()).build();

var message = "delimiter or delimiterString: '%s', and quoteCharacter: '%s' must differ";
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
var message = "delimiter or delimiterString: '%s', and quoteCharacter: '%s' must differ";
var message = "delimiter or delimiterString: '%s' and quoteCharacter: '%s' must differ";

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}

@Test
void doesNotThrowExceptionWhenDelimiterAndCommentCharacterTheSameWhenUsingValueAttribute() {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
void doesNotThrowExceptionWhenDelimiterAndCommentCharacterTheSameWhenUsingValueAttribute() {
void doesNotThrowExceptionWhenDelimiterAndCommentCharacterAreTheSameWhenUsingValueAttribute() {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.


@ParameterizedTest
@MethodSource("invalidDelimiterQuoteCharacterAndCommentCharacterCombinations")
void throwsExceptionWhenControlCharactersTheSameWhenUsingTextBlockAttribute(Object delimiter, char quoteCharacter,
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
void throwsExceptionWhenControlCharactersTheSameWhenUsingTextBlockAttribute(Object delimiter, char quoteCharacter,
void throwsExceptionWhenControlCharactersAreTheSameWhenUsingTextBlockAttribute(Object delimiter, char quoteCharacter,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

@sbrannen sbrannen left a comment

Choose a reason for hiding this comment

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

"looses" -> "loses"

below which demonstrates formatting similar to a table).
comments. Any line beginning with the value of the `commentCharacter` attribute (`+++#+++`
by default) will be treated as a comment and ignored. Note that there is one exception
to this rule: if the comment character appears within a quoted field, it looses
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
to this rule: if the comment character appears within a quoted field, it looses
to this rule: if the comment character appears within a quoted field, it loses

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

*
* <p>Any line that begins with this character will be treated as a comment
* and ignored during parsing. Note that there is one exception to this rule:
* if the comment character appears within a quoted field, it looses its
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* if the comment character appears within a quoted field, it looses its
* if the comment character appears within a quoted field, it loses its

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

*
* <p>Any line that begins with this character will be treated as a comment
* and ignored during parsing. Note that there is one exception to this rule:
* if the comment character appears within a quoted field, it looses its
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* if the comment character appears within a quoted field, it looses its
* if the comment character appears within a quoted field, it loses its

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants