Skip to content
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

Merged
merged 17 commits into from
Nov 7, 2020

Conversation

Criss-Wang
Copy link

@Criss-Wang Criss-Wang commented Nov 4, 2020

  • 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.

Criss-Wang and others added 13 commits November 4, 2020 15:56
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.
Copy link

@jeffreytjs jeffreytjs left a 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 👍

docs/UserGuide.md Outdated Show resolved Hide resolved
docs/UserGuide.md Outdated Show resolved Hide resolved
src/main/java/seedu/clinic/logic/commands/UndoCommand.java Outdated Show resolved Hide resolved
@codecov-io
Copy link

Codecov Report

Merging #224 into master will increase coverage by 4.39%.
The diff coverage is 67.78%.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ Complexity Δ
src/main/java/seedu/clinic/MainApp.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../main/java/seedu/clinic/commons/core/Messages.java 0.00% <ø> (ø) 0.00 <0.00> (ø)
.../main/java/seedu/clinic/commons/util/FileUtil.java 70.83% <0.00%> (-6.44%) 9.00 <0.00> (ø)
.../java/seedu/clinic/logic/commands/ExitCommand.java 100.00% <ø> (ø) 2.00 <0.00> (ø)
.../java/seedu/clinic/logic/commands/ListCommand.java 100.00% <ø> (ø) 2.00 <0.00> (ø)
...eedu/clinic/logic/commands/RemoveMacroCommand.java 100.00% <ø> (+100.00%) 7.00 <0.00> (+7.00)
src/main/java/seedu/clinic/model/Clinic.java 84.09% <0.00%> (-8.41%) 19.00 <0.00> (+1.00) ⬇️
src/main/java/seedu/clinic/model/Model.java 100.00% <ø> (ø) 2.00 <0.00> (ø)
src/main/java/seedu/clinic/model/UserMacros.java 89.65% <ø> (+21.91%) 14.00 <0.00> (+3.00)
.../main/java/seedu/clinic/model/attribute/Email.java 83.33% <ø> (ø) 7.00 <0.00> (ø)
... and 88 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 91ccedf...fd4a321. Read the comment docs.

@Criss-Wang Criss-Wang added this to the v1.4 milestone Nov 6, 2020
@Criss-Wang Criss-Wang self-assigned this Nov 6, 2020
}

@Test
public void execute_duplicateSupplier_throwsCommandException() {

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!

Comment on lines +267 to +277
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));
}

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??

Comment on lines +290 to +296
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 {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too!

Copy link

@tohyuting tohyuting left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tohyuting tohyuting merged commit 35a6861 into AY2021S1-CS2103-W14-4:master Nov 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants