Open koppor opened 4 months ago
How would I test to make sure just my additional tests work instead of having to run ./gradlew test which runs all the tests?
On the guidelines to setup a workspace. At the bottom. There was an optional section. Please follow the steps there
(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