I am new to
unit testing, and I am trying to test the handleCriteria(). I wanted to verify that root.get(Person_.firstName) on line 26 occurred. But, I am getting a null pointer exception. I am having a hard time figuring out how to mock things, and use when(). I have read some of the
mockito docs, and other tutorials. According to stack,
"A unit test should test a single codepath through a single method. When the execution of a method passes outside of that method, into another object, and back again, you have a dependency.
When you test that code path with the actual dependency, you are not unit testing; you are integration testing. While that's good and necessary, it isn't unit testing."
How can I test handleCriteria, and get rid of this null pointer exception?