As Junit 5 was released in order to be able to use mocks you need to add the mockito extension. You noticed that ClassRunners are deprecated now in Junit 5, they were replaced with extensions, hence the Mockito Extension. What changes are in Mockito 2? Well one of the most important one is the change… Continue reading Mockito 2
Tag: unit testing
Are you verifying your stubs?
What is stubbing? What is verifying? Do we need both? If we look into the java docs for Mockito.when() (stubbing) and Mockito.verify() (verifying behavior) we see something strange that is common to both: Although it is possible to verify a stubbed invocation, usually it's just redundant. Well, we known that the difference between stubs and… Continue reading Are you verifying your stubs?
Junit 5
What has changed? Is it still backwards compatible? Is it hard to migrate? These are some of the questions I want to answer with this post. Junit 5 is a bundle of 3 modules: platform, a platform for developing testing frameworks jupiter, the new programming model and extension model vintage, for running Junit 3 and… Continue reading Junit 5
Junit Theories
Theories are less known components of Junit, but lately I used them and thus decided to write about them. They come in handy when you have a situation when you need to test a behavior with multiple input values. Instead of writing tests for each situation you can specify a set of inputs and apply… Continue reading Junit Theories