Philip Heath (7) [Avatar] Offline
#1
I would like to suggest an alternate way to phrase comment #C on Listing 2.2

Current: "All Groovy objects inherit println method that outputs messages to console"

Suggested: "All Groovy code by default imports java.lang.* which allows direct calls to the println method"

The current comment implies a base class because of the use of the term inherit. My wording is probably not exactly what you want to use, but I think it would be better to refer to automatic or default imports in Groovy instead.
Kostis Kapelonis (63) [Avatar] Offline
#2
Hello

First of all, thank you for your feedback.

Actually that is exactly what I meant. I wrote "inherit" on purpose.
Remember that the book is geared at Java developers (who are well accustomed to how inheritance works)

In Groovy it is possible to write the following:

Date date = new Date()
date.println("hello")

Integer now = new Integer(4)
now.println("world")


Doesn't that imply to a Java developer (regardless of the actual mechanics) that both classes inherit the println method?

Even if you read the documentation of java.lang.Object in the Groovy docs at http://docs.groovy-lang.org/latest/html/groovy-jdk/java/lang/Object.html, among other methods (find(), each(), dump() etc.) the prinltn() method is clearly included.

So to the eyes of a Java developer the println method is really "inherited" from the base object java.lang.Object (even though in reality the implementation behind the scenes might be different)

Kostis
Philip Heath (7) [Avatar] Offline
#3
I see your point.

BTW, the book is really good so far. I'm partway through Chapter 5 now. Spock is definitely something to be excited about.
Kostis Kapelonis (63) [Avatar] Offline
#4
Thank you!

Judging by your blog, I think that you would be mostly interested in chapter 7 (integration/rest/web testing)

Kostis
Philip Heath (7) [Avatar] Offline
#5
Will Chapters 7 or 8 cover how to selectively run tests either using the @Requires annotation or SpockConfig.groovy? As test suites grow, there is a need to be able to group into subsets for different purposes such as unit, integration, smoke, etc.
Kostis Kapelonis (63) [Avatar] Offline
#6
Yes, that information already exists in chapter 8

The source code of the whole book (including chapters not yet in MEAP) is available on Github

https://github.com/kkapelon/java-testing-with-spock

You can look at listings 8.11, 8.12 and 8.13 for a preview of what will be discussed in the text of the book.

Kostis