Archive | testing RSS feed for this section

Basic and Digest authentication for a RESTful Service with Spring Security 3.1

This is the sixth of a series of articles about setting up a secure RESTful Web Service using Spring 3.1 and Spring Security 3.1. A previous article introduced security in the context of a RESTful service, using form-based authentication. This article will focus on configuration of Basic and Digest authentication and on configuring both protocols [...]

Read full story Comments { 1 }

RESTful Web Service Discoverability

This is the fourth of a series of articles about setting up a secure RESTful Web Service using Spring 3.1 and Spring Security 3.1 with Java based configuration. The article will focus on Discoverability of the REST API, HATEOAS and practical scenarios driven by tests.

Read full story Comments { 7 }

How to set up Integration Testing with the Maven Cargo plugin

A very common need in the lifecycle of a project is setting up integration testing. Luckily, Maven has built-in support for this exact scenario, with the following phases of the default build lifecycle (from the Maven documentation):

Read full story Comments { 3 }

Introduction to Java integration testing for a RESTful API

This post will focus on basic principles and mechanics of writing Java integration tests for a RESTful API (with a JSON payload). The goal is to provide an introduction to the technologies and to write some tests for basic correctness. The examples will consume the latest version of the GitHub REST API. For an internal [...]

Read full story Comments { 10 }

How to avoid brittle tests when testing the service layer

There are many ways to test the service layer of an application. The goal here is to show how to unit test this layer in isolation, by mocking out the interactions with the database entirely. This example will use Spring 3 for the dependency injection, JUnit, Hamcrest and Mockito for testing, but the technologies can [...]

Read full story Comments { 5 }