You now have two new DAO methods (
filterByCategory). Add tests to your existing DAO test class to test these two new methods.
It is important to remember to test for the negative case as well as the positive case. In other words, as well as checking that you get only 'apple' and 'orange' when you filter by the 'fruit' category --- you should also ensure that you don't also get a 'velociraptor' which would be the case if your method is not doing any filtering at all (it returns everything).
In the case of the
searchById method, the negative case would be to ensure that the method correctly handles a non-existent ID (it should return
You may want to refer to reference section Testing/Hamcrest for more examples of using Hamcrest assertions.