After add test cases - Jomsaruj/coffeemaker GitHub Wiki
The following JaCoCo test report is generated AFTER add more test cases
As you can see now my unit test cover 100% of instructions and branches for both CoffeeMaker and Inventory class
Here is the list of added test cases
| Test ID | Test Case Name | Description | Expected Result | Actual Result | Status |
|---|---|---|---|---|---|
| 56 | testPurchaseEmptyRecipe | involk method makeCoffee with non-exist recipe number and amount of money as parameters | return full amount of money that user input to the system | Same as expected result | pass |
| 57 | testSetInventoryToNegative | set all inventory to -1 | throws InventoryException | Same as expected result | pass |
Optional: I have add 3 more test case for Recipe class. Here is the list of added test cases
| Test ID | Test Case Name | Description | Expected Result | Actual Result | Status |
|---|---|---|---|---|---|
| 58 | testCompareDuplicateObject | compare 2 exactly duplicate object | method equal return true | Same as expected result | pass |
| 59 | testCompareDifferentObject | compare 2 object that is an instance of different class | method equal return false | Same as expected result | pass |
| 60 | testHasCode | test that code of same object is same and code of different object is different | each object has unique code | Same as expected result | pass |
It seem impossible to reach 100% coverage for class Recipe because there is a code where they check for null recipe name and it is impossible to set recipe's name as null