boardtc (8) [Avatar] Offline
#1
I am trying to follow the assertHost example on page 165, I try:

String dateRegEx = '([0-9]{2})/([0-9]{2})/([0-9]{4})'

//inline unit test
assertHost '04/05/2008|00:00|17|8|0|1395', dateRegEx, '04/05/2008'

def assertHost (cadidate, regex, expected) {
candidate.eachmath(regex) { asset it[1] == expected }
}

However in Eclipse I get a red line under the a in def assertHost, whicn indicates Unknown Type: METHOD_DEF

Any help appreciated.
Mittie (397) [Avatar] Offline
#2
Re: assertHost pg165 - Unknown Type: METHOD_DEF
Hi,

looks like you want to call 'eachMatch', not 'eachmath' smilie

For further questions regarding the eclipse plugin, please refer to the Groovy user mailing list user@groovy.codehaus.org.

thanks for posting
Dierk
boardtc (8) [Avatar] Offline
#3
Re: assertHost pg165 - Unknown Type: METHOD_DEF
Sorry for the typo. I still get the same error with the code. Why would the mailing list be more suitable than here for a specific question about the book code?
Mittie (397) [Avatar] Offline
#4
Re: assertHost pg165 - Unknown Type: METHOD_DEF
If you were having trouble with code examples from the book, I would be more that glad to provide any assistance I can. But your code is a customization of listing 6.7 and thus not genuine book code. If you copy listing 6.7 into groovyConsole and still have errors, then this forum is the right place to post.

Beside this, the mailinglist reaches more people, both for possibly answering your question and for learning from the answer.

hope you understand
Dierk
boardtc (8) [Avatar] Offline
#5
Re: assertHost pg165 - Unknown Type: METHOD_DEF
I was using code from your book but the problem was my fault, I apologize, the groovy compiler is not very informative yet - one gets this message when one tries to have an inner class, I had this code embedded in another procedure and inner classes are not yet supported by groovy.