5/4/2023 0 Comments Captor mockitoA spy helps to call all the normal methods of the object while still tracking every interaction, just as we would with a mock. annotation is used to create a real object and spy on that real object. Mockito.verify(mockHashMap, times(0)).get("A") ġ.2. Mockito.verify(mockHashMap, times(1)).put("A", 1) We put a key-value pair in Map, and then verified that method invocation was performed on mocked map Integer& gt void saveTest() In real tests, we shall be mocking actual application classes. In the given example, we have mocked the HashMap class.
0 Comments
Leave a Reply. |