The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Susan Harkins (424) [Avatar] Offline
Please list errors in the published version of Java Testing with Spock here. We'll compile and publish a comprehensive list for everyone's convenience. Thank you!

Susan Harkins
Errata Editor
Manning Publications
aken (1) [Avatar] Offline

I've found the following errors, mostly in the second half of the book.

Figure 5.10 appears to show the test output of the code in listing 5.11, instead of the code in 5.10. The point is that both snippets should show the same output, but the strings to report the parameters are different in each, which is confusing.

Section 6.3.4 opens (pg 177) by comparing the behavior of mocks in listings 6.13 and 6.14. 6.14 is a java class; 6.3.4 should mention listings 6.15 and 6.16 instead.

(Nitpick) Line 8 of 6.16 is missing a closing parenthesis. This error is not on gitHub (where the statement is on lines 19 and 40).

The fullCheckout() method is not shown as part of the BillableBasket class in 6.14, even though section 6.4 explicitly says it is (pg 184). The method is present on gitHub.

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.

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.

(Nitpick) Irregular formatting (a missing space) in 6.11 ("suite.price+ 60") and 7.1 (".getStock() ==0").

(Nitpick) The first two letters of "samsung" are bolded for some reason in 7.5.

Section 8.1.5 references the use of an argument for @AutoCleanup in listing 8.11 (pg 235). This should refer to listing 8.14.
On a more content-concerned note, I'm not sure this code snippet is a good example of the annotation on its own, though, since it makes it unclear that @AutoCleanup will automatically call any close() method in the spec if there is no argument (I had to read the following paragraph a few times to get this. The next paragraph finally spells it out as an afterthought, but it's still confusing.)

(Nitpick) Typo in 8.19 -- "contact details are kept or record" should probably be "contact details are kept ON record". This is present on gitHub.

Kostis Kapelonis (63) [Avatar] Offline
All corrections mentioned in your post have been added to the errata of the book.

Regarding your comment with Autocleanup you are correct that perhaps I should have showed first the basic version with no argument as a guide to readers.

I decided to show the argument version in the code listing because it is the most flexible.

The close() method only exists in JDK objects (streams, files, connections etc) but several business objects (which are used in unit tests)
may have other methods like shutdown, teardown, destroy e.t.c.

Many thanks for your time

MikeHT (137) [Avatar] Offline
In listing 8.15 at line 39, we have the code

		BankAccount account3 = new BankAccount()
			setHolder("John Doe")
		CreditCard card3 = new CreditCard("444455556666")
			setHolder("John Doe")

I think the second line of this code should be

			setHolder("John Doe")

That is, account2 was used where it should have been account3. I don't think it really matters, as these are all dummy classes anyway. But just for clarity...
Kostis Kapelonis (63) [Avatar] Offline
You are correct! Thank you for your feedback. I will add this to the next Errata update.
MikeHT (137) [Avatar] Offline
Be aware, the error is also shown in the listing in the book.
Susan Harkins (424) [Avatar] Offline
An errata list for Java Testing with Spock is available at Thank you for participating in this process. Your comments help us and other readers.

Susan Harkins
Errata Editor