March 2016
Intermediate to advanced
304 pages
8h 9m
English
JUnit doesn’t support mocking (faking external object communication) out of the box. Therefore, I usually employ Mockito[10] when I need to fake objects in my JUnit tests.
Many mock frameworks are available for Java, but Mockito is the easiest and most logical in my opinion. Some of its ideas have also found their way into Spock itself. See https://github.com/mockito/mockito.
If you’ve never used mocking in your unit tests, fear not, because this book covers both theory and practice (with Spock). I strongly believe that mocking is one of the pillars of well-written unit tests and I’m always puzzled when I see developers who neglect or loathe mocks and stubs.
The literature on mocking hasn’t reached ...
Read now
Unlock full access