We can verify a method its called or not?
This is the way to verify:
Mockito.verify(vaBuildRequestDao).create(Mockito.any(VaBuildRequest.class));
Above verify meaning we should expect a create method be called on VaBuildRequestDao.
Mockito.verify(vaBuildRequestDao,Mockito.times(2)).create(Mockito.any(VaBuildRequest.class));
Above verify meaning we are expecting the create method is called 2 times on VaBuildRequestDao .If it wont call the test case will be failed.
This is the way to verify:
Mockito.verify(vaBuildRequestDao).create(Mockito.any(VaBuildRequest.class));
Above verify meaning we should expect a create method be called on VaBuildRequestDao.
Mockito.verify(vaBuildRequestDao,Mockito.times(2)).create(Mockito.any(VaBuildRequest.class));
Above verify meaning we are expecting the create method is called 2 times on VaBuildRequestDao .If it wont call the test case will be failed.
No comments:
Post a Comment