1.

What Are Unfinished Verification/stubbing Errors?

Answer»

Mockito validates if you use it correctly all the time. Examples of incorrect use:

//Oups, SOMEONE forgot THENRETURN() PART:
when(mock.get());
//Oups, someone put the verified method call inside verify() where it should be outside:
verify(mock.execute());
//Oups, someone has used EasyMock for too long and forgot to specify the method to verify:
verify(mock);

Mockito THROWS exceptions if you misuse it so that you will know if your tests are written correctly. The only problem is that Mockito does the VALIDATION next time you use the framework. Therefore sometimes the exception is thrown in the next test and you have to manually find the previous test that was not written correctly.

Mockito validates if you use it correctly all the time. Examples of incorrect use:

//Oups, someone forgot thenReturn() part:
when(mock.get());
//Oups, someone put the verified method call inside verify() where it should be outside:
verify(mock.execute());
//Oups, someone has used EasyMock for too long and forgot to specify the method to verify:
verify(mock);

Mockito throws exceptions if you misuse it so that you will know if your tests are written correctly. The only problem is that Mockito does the validation next time you use the framework. Therefore sometimes the exception is thrown in the next test and you have to manually find the previous test that was not written correctly.



Discussion

No Comment Found