DatumEdge The website of James Shaw

Using JMock with Spring 3 tests

22 October 2012

Spring framework comes with a module, Spring Testing, that integrates with JUnit 4. It allows us to test Spring beans by wiring them into a JUnit test class. If we are writing an integration test, we may want to mock the dependencies of the bean under test. This article shows how to include those mock objects in a Spring ApplicationContext.

Read more…

Mocking REST resources with JMock and Jersey

2 August 2012

To test code that interacts with a REST resource, we need an HTTP server which provides access to a fake version of that resource. After a friend of mine released a fake HTTP library, I started thinking about whether JMock could be used to mock out REST resources.

Read more…

Java 8 lambdas

23 June 2012

Scheduled for release in 2013, Java 8 will include language support for lambda functions. Although the specification is still in flux, lambdas are already implemented in JDK 8 binaries.

Read more…

Publishing from GitHub to Maven Central

7 May 2012

Unless your project is hosted by an approved foundation such as Apache or Codehaus, you won't be able publish artifacts to Maven Central directly. Instead, Sonatype provide their own Nexus repositories for open source projects, and synchronise these with Maven Central.

Read more…

Idiomatic Hamcrest

7 April 2012

Hamcrest is a useful library that lets you build assertions declaratively. Having worked with the library for a while now, I've found a few useful patterns and a handful of gotchas when writing Hamcrest matchers.

Read more…