Posts tagged with "Mockito"

Jul 1st, 2013

when( true ).throwIllegalArgument( “something went wrong” );

As a framework developer I have to make sure that my framework works properly – and among other things, that means it has to be used in the way that I meant it to be used. One option to achieve this is to validate the input. With input I basically mean method parameters. For example, [...]

Nov 7th, 2012

A Software Craftsman’s Toolbox: Lightweight Java libraries that make life easier.

As a software developer you will use plenty of frameworks during your career. There are the big beasts like Spring, ActiveMQ or OSGi that you have to master in order to build the foundations of your applications. And then, there are the small frameworks. Let’s call them lightweight tools. Like a carpenter, the lightweight tools [...]

Oct 19th, 2012

Software Craftsmanship at EclipseCon Europe 2012

In some of my previous posts I’ve talked about well-crafted code. I’m really convinced that software development is a craft – but what does that mean? The “Manifesto for Software Craftsmanship” contains the following 4 points: Considering these points I took a look at the EclipseCon Europe 2012 session schedule and picked out a view [...]

Leave a Comment
Sep 25th, 2012

Advanced Android testing with RoboGuice and Robolectric

I’ve been using the Android framework RoboGuiceĀ 2.0 a lot lately. RoboGuice is an extension for the Google Guice dependency injection framework that adds several Android specific mechanisms to easily inject views, services or custom objects. Coming from an OSGi background, it is interesting to see how much deeper Guice is able to be interwoven into [...]

Jun 15th, 2012

Serious unit testing on Android

It is not a secret that we are big fans of Mockito at EclipseSource. Our Java mocking framework of choice has helped us in many projects to stay on the test driven development path. Luckily we are also able to apply these same principles when developing Java code on Android. Although Mockito is great for [...]

Leave a Comment
Nov 16th, 2011

Effective Mockito Part 5

With this effective Mockito Post I want to share a really simple pattern with you. We call this pattern “check answers” and we use it whenever we work with Mockito Answers. The code resulting from creating Mockito Answers generally looks ugly. But, as good programmers we care about test quality, right? :) Let’s see how [...]

Oct 17th, 2011

Effective Mockito Part 4

This Effective Mockito Post will be IDE specific again but related to the last post on Mockito’s spies. If you’ve read Part 3 you should now be familiar how to use them to “pseudo mock” statics. When writing code it often comes to a point where we want to debug using single step debugging. When [...]

Leave a Comment
Oct 13th, 2011

Effective Mockito Part 3

In the previous Effective Mockito post we saw how to use the @Mock Annotation to get a clean test. In this post I want to show you how to use Mockito’s spy mechanism to eliminate testing troubles with third party libraries. Testing is one of the most important things in software development. I assume you [...]

Sep 29th, 2011

Effective Mockito Part 2

As promised in the first part of the “Effective Mockito” blog series, I will concentrate on Mockito specifics in the followup posts. So, the main topic for Part 2 is Mockito’s @Mock Annotation. When I write tests I try to follow an explicit pattern, called the build-operate-check pattern. This was described by Uncle Bob in [...]