Refactor tests to use parameterized tests#14054
Conversation
| private final BibtexString bs1 = new BibtexString("VLSI", "Very Large Scale Integration"); | ||
| private final BibtexString bs2 = new BibtexString("DSP", "Digital Signal Processing"); | ||
| private final BibtexString bs3 = new BibtexString("DSP", "Digital Signal Processing"); | ||
| private final BibtexString bs4 = new BibtexString("DSPVLSI", "#VLSI# #DSP#"); |
There was a problem hiding this comment.
Can you give the variables more meaningful names? Helps a lot in reading the single tests.
| @CsvSource({ | ||
| // Return the same string | ||
| "abc, abc", "aaa, aaa", "(p < 0.01), (p < 0.01)", | ||
|
|
||
| @Test | ||
| void basic() { | ||
| assertEquals("aaa", formatter.format("aaa")); | ||
| } | ||
| // IEEE-style HTML entity for em dash | ||
| "Towards situation-aware adaptive workflows: SitOPT --- A general purpose situation-aware workflow management system, Towards situation-aware adaptive workflows: SitOPT &#x2014; A general purpose situation-aware workflow management system", |
There was a problem hiding this comment.
Thanks for pointing that out! I updated the other arguments in this method so each test case is on its own line.
This one is a single test case, so I kept it on one line even though it’s a bit long, but I’m happy to break it up if you’d prefer.
1c300be to
45d3ab0
Compare
…ine helper method, and improve readability
45d3ab0 to
61f1680
Compare
|
Thank you for the code review and helpful suggestions! I’ve applied the requested changes and also rebased with the latest version of After pushing, I realized I had accidentally committed local auto-generated files ( Please let me know if there’s anything else you’d like me to adjust. |
|
looks good to me. shall we wait for your classmates to open their prs or should move forward? |
|
sorry, hit the wrong butten |
|
Your pull request needs to link an issue correctly. To ease organizational workflows, please link this pull request to the issue by including a supported keyword in the pull request's description as per syntax described in GitHub's documentation. Examples
|
|
The PR can always be reviewed in the merged/closed PR list. But better to have it integrated instead of keeping it in the list of open PRs for too long. Thanks for your contribution. |
|
On second thought, better to wait, i can see in the issue that not everybody is done with his/her PR. |
|
maybe we can reopen the issue after merge? |
@koppor said by email to me (9/21) that it is okay to have separate PRs for each student (11 of them). I have instructed them to follow each other's reviews so you don't have to repeat the same guidance. I can let you know when all are done and the issue can be closed. Thanks for doing the reviews! |
|
Changed Reference in PR description from fixes to refs. Will enable merge queue again. |
* Parameterize tests for Issue JabRef#676 * Address PR review feedback: reformat CsvSource, rename variables, inline helper method, and improve readability
* Parameterize tests for Issue JabRef#676 * Address PR review feedback: reformat CsvSource, rename variables, inline helper method, and improve readability
Refs JabRef#676. I am part of a Java graduate school class. My classmates will submit other PRs that address this issue as well.
This PR refactors multiple test classes to follow the one-assertion-per-test guideline and improve overall test readability and maintainability. Parameterized tests (
@CsvSourceand@MethodSource) were introduced where appropriate to replace repetitive assertions, and one test file was renamed so that it matched the case of its class name.Steps to test
To test this code run:
Mandatory checks
CHANGELOG.mdin a way that is understandable for the average user (if change is visible to the user)