First Functionality

Applying the recipe from Chapter 3, I jumped immediately into the happy path. The purpose of the application is to retrieve content from URLs. The simplest happy path retrieves content from a single URL. I defined the basic retrieve() method through its test (Listing 14-1).

Listing 14-1: Defining a simple retrieve() method by using it in its test [0c2d67e]. This “fails” because the method does not exist.

@Testpublic void testRetrieve_SingleURI() {  WebRetriever sut = new WebRetriever();  String content = sut.retrieve("http://www.example.com");}

For now, in the spirit of YAGNI, the simplest implementation takes the URL and returns the retrieved content as strings, deferring the questions of command-line ...

Get Quality Code: Software Testing Principles, Practices, and Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.