Mockito is a mocking framework that tastes really good. It lets you write beautiful tests with a clean & simple API. Mockito doesn’t give you hangover because the tests are very readable and they produce clean verification errors.
An example of code could be:
mock(Foo.class, withSettings().name("bar")
.serializableMode(ACROSS_CLASSLOADER)
.verboseLogging().invocationListener(...));
This site(in links) has a stupendous tutorial about mockito. It makes substantially easier to do dependency injection and compile time checks.
Links
https://www.lambdatest.com/blog/junit5-mockito-tutorial/