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 null value attribute to @CsvSource and @CsvFileSource #1883

Conversation

Farbauti89
Copy link
Contributor

@Farbauti89 Farbauti89 commented May 17, 2019

Overview

This PR implements the proposed enhancement in #1856 .

It will introduce a nullSymbols attribute in the CsvSource and CsvFileSource Annotation.
The nullSymbols will be converted into null if it is found in the CSV.

Resolves #1856


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


Definition of Done

Copy link
Member

@sormuras sormuras left a comment

Choose a reason for hiding this comment

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

Looks good overall, left some comments in-line.

@sormuras sormuras changed the title 1856 add null value attribute to csvsource and csvfilesource Add null value attribute to CsvSource and CsvFileSource May 17, 2019
@Farbauti89
Copy link
Contributor Author

Hello Maintainers,

I am a first time commiter in this project and not sure about the "Definition of Done".
Do you tick the checkboxes when you check the PR or is this something I should do?

Also this is a PreView PR because I wanted to make sure the change is cool for you.
If it's okay I will wait with the documentation until then.

@sormuras
Copy link
Member

Please run 'gradlew spotlessApply' to fix source code format violations automatically.

@Farbauti89
Copy link
Contributor Author

@sormuras i fixed the formatting issue.
Sorry for the inconvenience :(

I also have a questions about the "Definition of Done".
Do you as a maintainer tick the checkboxes or is this something I should do when I think the PR is ready?

@sormuras
Copy link
Member

Thanks for the PR! 👍

Do you as a maintainer tick the checkboxes or is this something I should do when I think the PR is ready?

They are an indicator how for a PR is. Check them when you think a task is done. We'll go over them and double-check anyway.

@Ciruman
Copy link
Contributor

Ciruman commented May 17, 2019

I like how you solved the problem with the processor and looks good to me. Thank you for the PR!

@Farbauti89
Copy link
Contributor Author

Looks good overall, left some comments in-line.

-@sormuras

Hello @sormuras , I think I'am done with this PR.
Github tells me that you still request one change. I think it's the comment above.
If there is anything else to fix let me know :)

@Ciruman
Copy link
Contributor

Ciruman commented May 20, 2019

As an improvement, in case of having nullSymbols = {}, there is no need to create a processor and there is no need to process the pasedLine in both CSV Argument Providers.

@sbrannen
Copy link
Member

sbrannen commented Jul 5, 2019

@Ciruman, this PR now contains a lot of noise.

Can you please rebase your work on master, squash into a single commit, and force push the changes?

@Ciruman
Copy link
Contributor

Ciruman commented Jul 5, 2019

@sbrannen, I did not create the PR. The PR was created by @Farbauti89 . @Farbauti89, can you update the PR?

@sbrannen
Copy link
Member

sbrannen commented Jul 5, 2019

@sbrannen, I did not create the PR.

Indeed. Sorry about mixing up the user names.

@Farbauti89 Farbauti89 force-pushed the 1856-add-nullValue-attribute-to-csvsource-and-csvfilesource branch from 5153928 to 4d0a858 Compare July 12, 2019 06:49
@Farbauti89
Copy link
Contributor Author

Hi @sbrannen,

this PR now contains a lot of noise.

Can you please rebase your work on master, squash into a single commit, and force push the changes?

I did, as you commanded - at least I hope so :)

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.

Thanks for squashing and rebasing on master!

I've added a few additional requests for the time being.

@sbrannen sbrannen added this to the 5.6 M1 milestone Jul 17, 2019
@sbrannen
Copy link
Member

Tentatively slated for 5.6 M1

@Farbauti89 Farbauti89 force-pushed the 1856-add-nullValue-attribute-to-csvsource-and-csvfilesource branch 2 times, most recently from 454ea24 to 1101f70 Compare July 19, 2019 12:40
@sbrannen
Copy link
Member

Thanks for making the requested changes.

In general, I think the PR looks pretty good, but I have not performed an in-depth technical review of the implementation yet.

Copy link
Member

@sormuras sormuras left a comment

Choose a reason for hiding this comment

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

@Farbauti89 Please rebase your PR once more -- I'll review it finally shortly after that.

@Farbauti89 Farbauti89 force-pushed the 1856-add-nullValue-attribute-to-csvsource-and-csvfilesource branch from 1101f70 to 16c2cb1 Compare September 27, 2019 08:23
@Farbauti89 Farbauti89 changed the title Add null value attribute to CsvSource and CsvFileSource [WIP] Add null value attribute to CsvSource and CsvFileSource Sep 27, 2019
The new `nullSymbols` Attribute can be used in the @CsvSource- and
@CsvFile-Annotation to describe values that should be interpreted as
`null`

Issue: junit-team#1856
@Farbauti89 Farbauti89 force-pushed the 1856-add-nullValue-attribute-to-csvsource-and-csvfilesource branch from 16c2cb1 to f7b8fdc Compare September 27, 2019 08:42
@Farbauti89 Farbauti89 changed the title [WIP] Add null value attribute to CsvSource and CsvFileSource Add null value attribute to CsvSource and CsvFileSource Sep 27, 2019
@Farbauti89
Copy link
Contributor Author

@sormuras I just rebased the PR.

@sormuras
Copy link
Member

Thanks. Reviewing today.

Copy link
Member

@sormuras sormuras left a comment

Choose a reason for hiding this comment

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

LGTM. We'll take it from here.

@sormuras sormuras merged commit 9baadd9 into junit-team:master Sep 27, 2019
@sormuras
Copy link
Member

Merged. Thanks again, @Farbauti89 🎉

sormuras added a commit that referenced this pull request Sep 27, 2019
@sbrannen
Copy link
Member

sbrannen commented Sep 28, 2019

FYI: the implementation of this feature has been revised in fe62243, 1006517, and f239cb4.

@sbrannen sbrannen changed the title Add null value attribute to CsvSource and CsvFileSource Add null value attribute to @CsvSource and @CsvFileSource Sep 28, 2019
@sbrannen
Copy link
Member

... and even further revised in 3efdced and 179d82f. 😉

@Farbauti89
Copy link
Contributor Author

@sbrannen the implementation you did in 1006517 is far simpler. Now that I see it I am really wondering why I implemented this behaviour with univocity 🤦‍♂

The other changes also improve the readability.

Thanks for notifying me about this. I really think I learned something :)

@Farbauti89 Farbauti89 deleted the 1856-add-nullValue-attribute-to-csvsource-and-csvfilesource branch October 4, 2019 11:02
@sbrannen
Copy link
Member

sbrannen commented Oct 4, 2019

@sbrannen the implementation you did in 1006517 is far simpler. Now that I see it I am really wondering why I implemented this behaviour with univocity 🤦‍♂

No worries. We, as software engineers, often do our best to avoid reinventing the wheel (which is a good thing). So if a library already has a feature we need, it's tempting to just use it.

In this case, none of us realized there was a simpler (and more efficient) solution while reviewing the PR in the browser. I only noticed it while reviewing the changes in my IDE after the PR had been merged into master.

Thanks for notifying me about this. I really think I learned something :)

You're welcome. And... I also learned a lot more about the internals of Univocity in the process. So we all learned something. 😉

@sbrannen sbrannen self-assigned this Oct 18, 2019
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.

Add nullValue attribute to @CsvSource and @CsvFileSource
5 participants