Java Reference
In-Depth Information
Listing 2.8. The getGames method from GetGameData
The =~ method in Groovy returns an instance of java.util.regex.Matcher . The
parentheses in the regular expression are groups, which let me extract the away team ab-
breviation, the home team abbreviation, and the game number from the URL. I use those
to call the getGames method from listing 2.7 and put the results into a collection of
GameResult instances.
Testing
All that's left is to test the complete GetGameData class. A JUnit test to do so is shown
in the next listing.
Search WWH ::




Custom Search