In the previous post, I wrote how you can use Spring’s FactoryBean to facilitate the creation of mock objects for Spring integration tests. Now, it is time to use the EasyMockFactoryBean (in this post EasyMock has been used for creating mock objects, but a similar approach applies to Mockito as well. Start by looking at [...]
Spring Integration Tests, Part II, Using Mock Objects
December 12th, 2011 by Mattias Severson — Java, Testing
Tags: easymock, mock, mockito, spring
Spring Integration Tests, Part I, Creating Mock Objects
November 30th, 2011 by Mattias Severson — Java, Testing
When writing integration tests with Spring, it can sometimes be convenient to mock one or more of Spring bean dependencies. However, during some circumstances strange things may happen… (In this post, Mockito has been used for creating mock objects, but the same problem applies to EasyMock as well. You can find the corresponding files if [...]
Tags: easymock, factory-method, factorybean, mock, mockito, spring
EasyMock: Capturing arguments from multiple calls
March 25th, 2009 by Jens Nordahl — Testing
With EasyMock it is, in some cases, difficult to set up sufficiently precise expectations for the mocks. This may be because we don’t know in advance with which arguments they get called or how often they get called. Or because the verification, we have to make in the test, involves relating the calls to one mock object to the calls to another mock object or relating calls to mock objects to data returned from the object being tested.
In such cases the solution may be to capture “traces” of the method calls to the mock objects, and then, after having exercised the object being tested, to make the needed verifications using the captured traces.
Tags: easymock
What’s new in PowerMock 1.1
December 15th, 2008 by Johan Haleby — Java, Testing
We’re proud to announce that PowerMock 1.1 was released a couple of days ago and it has many new interesting features. Framework independence First of all the internal structure of the project has undergone major changes. PowerMock core is no longer coupled to EasyMock which means that PowerMock can now be used as a foundation [...]
Tags: commons-logging, easymock, frameworks, jmock, log4j, mockito, open source, powermock, slf4j, testng
PowerMock 1.0 released
November 21st, 2008 by Jan Kronquist — Java, Testing
We have released 1.0 of PowerMock just in time for the Øredev conference! PowerMock is an open source mock framework based on EasyMock that allow you to mock static methods, private methods and even constructors. Our intent is mainly to allow unit testing of legacy code and people really seemed to appreciate this idea at the conference.
Tags: easymock, junit, mock, open source, oredev, powermock
PowerMock 0.8 released
October 27th, 2008 by Johan Haleby — Java, Testing
Previously a colleague of mine described an idea for mocking static methods. Earlier this year we started an open source project to implement these ideas in a very simple to use form. The idea is that it will just be a normal jar file that extends EasyMock and JUnit. Instead of using AspectJ we have [...]
Tags: easymock, frameworks, junit, mock, open source, powermock
Static Mock using AspectJ
February 16th, 2007 by Jan Kronquist — Testing
After seeing MockME developed by some of my colleagues I started thinking about how this could be made in a generic way.
