Write-tests-for-the-EditContact-and-EditContactMenu-classes-#108-#112
Write-tests-for-the-EditContact-and-EditContactMenu-classes-#108-#112
Conversation
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferencesCodacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more |
…and-EditContactMenu-classes-#108-' into Write-tests-for-the-EditContact-and-EditContactMenu-classes-#108-
|
|
||
| private PhoneBookInterface phoneBookInterface; | ||
| private EditContactMenu editContactMenu; | ||
|
|
There was a problem hiding this comment.
Seems like test logic clashes the Triple AAA pattern
|
|
||
| @ParameterizedTest | ||
| @CsvSource({"1, New Name", "2, 987654321", "3, new.email@example.com", "4, newGithubID", "5, invalid"}) | ||
| void testEditContactMenuEdit(String userChoice, String userInput) throws IOException { |
There was a problem hiding this comment.
Please consider using more informative method name. What is the expected behaviour of the test? Is it _SuccessfulEditing, _CorrectEditing, _EditsSuccessfuly? Do we really need prefix "test" here?
| assertEquals(0, result); | ||
|
|
||
| ContactDto updatedContact = editContactMenu.getContact(); | ||
|
|
There was a problem hiding this comment.
Consider declaring local parameters or even const variables:
private final String ONE = "1";
...
String expectedName = "New Name";
if (userChoice.equals(ONE) && userInput.equals(expectedName)) { assertEquals(expectedName, updatedContact.getFullName()); verify(phoneBookInterface, times(1)).edit(updatedContact); ...
No description provided.