We haven't mentioned where JaCoCo fits in yet. JaCoCo is a test coverage tool. It monitors your system while it is being tested and can tell you which bits of your system were executed during the tests. NetBeans can show you the results by highlighting your code. This is a fairly crude way of quickly seeing where your tests are lacking --- code that isn't executed when the tests run is code that hasn't been tested.
Right click the root of your project in the <
> pane and select < Collect and Display Code Coverage">>.Now take a look at your Invoice
class. You should see that some of the code is highlighted in green and some is red. The red bits are code that was not executed during the tests, and the green bits are the code that was. In this case the red bits are just simple getter methods, so we don't really care that we missed them in the tests.
assert
statements in the tests that check that the code is actually doing what it is supposed to be doing.