5. walking
skeleton
“Implementation of the
thinnest possible slice of
real functionality that we
can automatically build,
deploy, and test end-to-
end”
original idea by Alistair Cockburn
24. Falling integration test
public class ChirpJsonRepositoryTest extends TestCase {
private ChirpRepository repository = new ChirpJsonRepository();
public void test_returns_the_timeline_of_a_chirper() {
assertTimelineEqualTo(repository.findTimelineOf("mgryszko"), mgryszkosChirps());
}
}
25. Passing integration test
public class ChirpJsonRepository implements ChirpRepository {
public List<Chirp> findTimelineOf(String chirper) {
return executeJsonRequest("http://...", chirper);
}
private List<Chirp> executeJsonRequest(String uri, Object... requestParams) {
RestTemplate restTemplate = new RestTemplate();
return asList(restTemplate.getForObject(uri, Chirp[].class, requestParams));
}
}
26. Passing integration test
public class TimelineActivity extends Activity {
private List<Chirp> loadTimeline() {
return executeJsonRequest("http://...", "mgryszko");
}
private List<Chirp> executeJsonRequest(String uri, Object... requestParams) {
RestTemplate restTemplate = new RestTemplate();
return asList(restTemplate.getForObject(uri, Chirp[].class, requestParams));
}
}
27. Passing integration test
public class TimelineActivity extends RoboActivity {
@Inject
private ChirpRepository chirpRepository;
private List<Chirp> loadTimeline() {
return chirpRepository.findTimelineOf("mgryszko");
}
}