Errata: January 31, 2019

Thank you for purchasing Java Testing with Spock. We'll update this list as necessary.

Unless otherwise noted, all errors have been or are pendng correction in all formats.


In chapter 5, page 142, section 5.2.6:

This correction hasn't been made in any format.

Figure 5.10 actually shows the test output of the code in listing 5.11, instead of the code in 5.10. Code from 5.10 produces the same result but with the sentence "Adder test #first, #second and #sum (alt2)" instead of "Testing the Adder for #first + #second = #sum."

In chapter 6, page 172, section 6.2.5:

Listing 6.11 is missing a formatting space. It should be:

+ laptop.price + ebook.price + 3 * suite.price + 60

In chapter 6, page 177, section 6.3.4:

Section 6.3.4 opens by comparing the behavior of mocks in listings 6.13 and 6.14. The listing numbers are wrong. The text actually talks about listings 6.15 and 6.16.

In chapter 6, page 177, section 6.3.4:

Listing 6.16 is missing a closing parenthesis in the annotated line. It should be:

CreditCardProcessor creditCardSevice = Mock(CreditCardProcessor)

In chapter 6, page 183, section 6.3.7:

The text after listing 6.22 (pg 183) says that the first argument of the sale() method should be the number (price) 1500, even though all code samples check for the correct sum of 1550.

In chapter 6, page 184, section 6.4:

The fullCheckout() method is not shown as part of the BillableBasket class in 6.14, even though section 6.4 explicitly says it is. The method is present on gitHub. Also the text mentions listing 6.12 next to figure 6.4. It should mention 6.14 instead.

In chapter 6, pages 185-186, section 6.4:

In the printed version of the book only, listing 6.25 and 6.26 (the last listings of chapter 6) contain font of two different weights, as though the original IDE colors were sent to print. While this is pleasant on the eyes, all other code uses the same font weight throughout.

In chapter 7, page 200, section 7.2.1:

Listing 7.1 is missing a formatting space. It should be:

allProducts[0].getStock() == 0

In chapter 7, page 221, section 7.5.2:

Just before listing 7.14, text talks about "Junit." It should be "JUnit" as the rest of the book.

In chapter 8, page 235, section 8.1.5:

The text mentions listing 8.11 as an example of the @AutoCleanup annotation. The correct listing is 8.14.

In chapter 8, page 241, section 8.2.2:

Listing 8.19 contains a spelling mistake. The text "contact details are kept or record" should be "contact details are kept on record."