Recently, I was working on a project and I missed a case in unit tests. I didn’t want to verify each argument but rather wanted to check if an object has a certain attribute set. In the older versions of mockito, this wasn’t doable. Since mockito 2.1, you can now do argument verification through argThat. Let’s see an example of this in action. @Test public void testWritesWithAttributes(){…
Leave a CommentTag: testing
Refactoring is in general restructuring the code without changing its behavior. The key point here is the behavior because we need to make sure that the behavior remains the same after the refactoring. How do we make sure the behavior stays same: tests. Tests make sure our system or component behaves as expected under certain conditions. When we have tests in place then it’s easy to do…
Leave a Comment