Enterprise applications and mobile applications have quite different requirements. Starting an enterprise application is just something you do once before it continue running for months or years. On the other side of the spectrum most mobile applications seldom runs for more than minutes, run by a bored users standing in line or riding the bus. [...]
Learn to Stop Worrying and Love the Singleton
January 15th, 2010 by Fredrik Olsson — Android, Architecture, Embedded, Java, Tips & Tricks
Tags: design patterns, java me, mobile, mock, performance, spring ldap
Getting started with JavaME jUnit testing
March 22nd, 2009 by Mattias Severson — Embedded, Java, Testing
Introduction
Unit testing is a very powerful tool that should be included in every developer’s toolbox. Unfortunately, this has not always been the case, especially not among MIDlet developers. One reason is that JavaME projects usually are small (compared to Java SE projects), which implies that manual testing could be enough. However, as soon as you [...]
Tags: java me, junit, mock, powermock
How to mock MIDP RecordStore
March 22nd, 2009 by Mattias Severson — Embedded, Java, Testing
The challenge
PowerMock is a mocking framework that claims to have almost supernatural powers. According to its documentation it is able to mock both static and private methods, final classes, and other nasty things that would be insurmountable obstacles for other mock frameworks. As a result, it has been stated that it should be able to [...]
Tags: java me, junit, mock, powermock
Mocking Eclipse IResource.accept()
January 15th, 2009 by Tobias Södergren — Java, Testing, Tips & Tricks
I had a junit test situation where I wanted to mock an Eclipse IResource instance but still be able to test a call-back implementation given as parameter to the mocked IResource.accept(IResourceVisitor visit) method. By default, mocking an interface gives you “call count” and expected return values but no code is executed. In order to test the implementation of IResourceVisitor, something more had to be done. Here is how I did it.
Tags: eclipse, junit, mock, programming
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
Mocking Classes
May 9th, 2007 by Ulrik Sandberg — Java, Testing
Mocking a class rather than an interface might present some interesting obstacles. Perhaps you have ran into the dreaded:
Unexpected method call toString():
toString(): expected: 0, actual: 1
You think nothing of it and happily add an expectation for toString. Then you get:
Unexpected method call toString():
toString(): expected: 1, actual: 2
The reason is that EasyMock [...]
Tags: mock, programming
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.
