Being able to define extension functions to classes that belong to third-party libraries looks very nice at the first point. However, they might become a road blocker during your unit testing, if you are working with Mockito as the mocking library. Let’s talk about the problem using an example, let’s write an extension function to […]
Tag: test
Weird Rollback Behavior of Spring TestContext Framework
One of the nice features of TestContext module of Spring Application Framework is its ability to run unit tests within a transaction context. By that way, you are able to both execute your persistence operations which usually expect an active transaction to run, and also rollback state changes occur during execution of these persistence operations […]
Mocking ResourceBundle
If you want to unit test a method that depends java.util.ResourceBundle, and want to isolate bundle access code with mocking ResourceBundle, using for example, JMock Dynamic Mocking Library, you will face with a restriction, that commonly used methods, such as getString(key) are defined as final in ResourceBundle class. There is no way to extend and […]
Cactus XOR Mocks or Cactus AND Mocks?
We employ both Spring and Hibernate to implement business and data access layers in our current project. Our aim is to bring clear separation between those two layers. Beans in business layer act as service entry points. They simply realize our use case scenarios. They are also good candidates as start and end points for […]