-
Notifications
You must be signed in to change notification settings - Fork 4
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
Write additional test cases to increase code coverage #224
Write additional test cases to increase code coverage #224
Conversation
Criss-Wang
commented
Nov 4, 2020
•
edited
edited
- Go through an overhaul of all code and write additional test cases for the code.
- Reduce code duplication (in particular the use of ModelStub) in test cases.
- Safe delete the AddProduct-related classes and occurances.
The bugs with undo/redo are fixed. Let's write addtional test cases to identify these bugs and also cover other components in the code.
# Conflicts: # src/test/java/seedu/clinic/logic/commands/UpdateCommandTest.java # src/test/java/seedu/clinic/logic/parser/ClinicParserTest.java
# Conflicts: # src/main/java/seedu/clinic/model/ModelManager.java # src/test/java/seedu/clinic/logic/commands/AddCommandTest.java # src/test/java/seedu/clinic/logic/commands/UpdateCommandTest.java # src/test/java/seedu/clinic/testutil/ModelStub.java
# Conflicts: # src/main/java/seedu/clinic/logic/commands/UndoCommand.java # src/test/java/seedu/clinic/logic/parser/EditCommandParserTest.java
Remove some redundant variables and methods and test more on the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The increase in test coverage is definitely significant in this PR, amazing work with the cleaning up of codes as well Zhen Lin 👍
src/test/java/seedu/clinic/model/macro/UniqueMacroListTest.java
Outdated
Show resolved
Hide resolved
Codecov Report
@@ Coverage Diff @@
## master #224 +/- ##
============================================
+ Coverage 70.94% 75.33% +4.39%
- Complexity 760 917 +157
============================================
Files 107 115 +8
Lines 2595 2956 +361
Branches 345 388 +43
============================================
+ Hits 1841 2227 +386
+ Misses 628 598 -30
- Partials 126 131 +5
Continue to review full report at Codecov.
|
} | ||
|
||
@Test | ||
public void execute_duplicateSupplier_throwsCommandException() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops minor typo in method name!
public void parseAlias_validValueWithoutWhitespace_returnsEmail() throws Exception { | ||
Alias expectedAlias = new Alias(VALID_ALIAS); | ||
assertEquals(expectedAlias, ParserUtil.parseAlias(VALID_ALIAS)); | ||
} | ||
|
||
@Test | ||
public void parseAlias_validValueWithWhitespace_returnsTrimmedEmail() throws Exception { | ||
String aliasWithWhitespace = WHITESPACE + VALID_ALIAS + WHITESPACE; | ||
Alias expectedAlias = new Alias(VALID_ALIAS); | ||
assertEquals(expectedAlias, ParserUtil.parseAlias(aliasWithWhitespace)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops a little confused here as well! Why is this returning an email??
public void parseCommandString_validValueWithoutWhitespace_returnsEmail() throws Exception { | ||
SavedCommandString expectedCommandString = new SavedCommandString(VALID_COMMAND_STRING); | ||
assertEquals(expectedCommandString, ParserUtil.parseCommandString(VALID_COMMAND_STRING)); | ||
} | ||
|
||
@Test | ||
public void parseCommandString_validValueWithWhitespace_returnsTrimmedEmail() throws Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This too!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM