Susan Harkins (222) [Avatar] Offline
#1
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
#2
Hi,

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 (53) [Avatar] Offline
#3
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

Kostis
Susan Harkins (222) [Avatar] Offline
#4