You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cannot be covered using CsvSource, because the empty string in CsvSource is reduced to null by JUnit. Thus, keep that test separatere, and only test the non-empty string with CsvSource.
Tasks
Rewrite fixAuthorLastNameOnlyCommas using @CsvSource and @ParameterizedTest
Split AuthorListTest#getAuthor into three test methods
Rewrite AuthorListTest#removeStartAndEndBraces using @CsvSource and @ParameterizedTest
Try to split or rewrite other test methods in AuthorListTest
The text was updated successfully, but these errors were encountered:
(META: This issue is reserved for a university course. Please only work on it if it is part of your assignment)
Context
In unit tests, there should be one assertion per test. An anti-pattern is to include multiple, un-related assertions in one test method. For instance, this is the case at [AuthorListTest#fixAuthorLastNameFirstCommasOxfordComma]https://github.com/JabRef/jabref/blob/1ebe80224500556e3b5a2076f5d388671a59dd8d/src/test/java/org/jabref/model/entry/AuthorListTest.java#L338).
A good practice is to have Parameterized Tests instead of mass code duplication. For instance,
can be replaced by
One can also use
@MethodSource
if issues with@CsvSource
are encountered.The code
Cannot be covered using CsvSource, because the empty string in CsvSource is reduced to
null
by JUnit. Thus, keep that test separatere, and only test the non-empty string with CsvSource.Tasks
fixAuthorLastNameOnlyCommas
using@CsvSource
and@ParameterizedTest
AuthorListTest#getAuthor
into three test methodsAuthorListTest#removeStartAndEndBraces
using@CsvSource
and@ParameterizedTest
AuthorListTest
The text was updated successfully, but these errors were encountered: