Blogspot - mrhaki.blogspot.com - Messages from mrhaki
General Information:
Latest News:
Spocklight: Writing Assertions for Arguments Mock Methods 17 May 2013 | 06:26 am
My colleague Arthur Arts has written a blog post Tasty Test Tip: Using ArgumentCaptor for generic collections with Mockito . This inspired me to do the same in Spock. With the ArgumentCaptor in Mockit...
Spocklight: Change Return Value of Mocked or Stubbed Service Based On Argument Value 17 May 2013 | 06:11 am
My colleague Albert van Veen wrote a blog post about Using ArgumentMatchers with Mockito . The idea is to let a mocked or stubbed service return a different value based on the argument passed into the...
Grails Goodness: Checking Results from Forward Action in Controller Unit Tests 16 May 2013 | 02:59 pm
In Grails we can write unit tests for controllers. We can check for example the results from a redirect() or render() method. To check the result from a forward() action we can use the forwardedUrl pr...
Grails Goodness: Passing Objects to Attributes of Tags in Unit Tests 14 May 2013 | 12:41 pm
Unit testing tag libraries in Grails is easy. We can use the applyTemplate() method to execute a tag and check the output. We pass the HTML string representing the tag to applyTemplate() as we would u...
Spocklight: Using a Custom Hamcrest Matcher 14 May 2013 | 07:57 am
In a previous blog post we learned how we can use Hamcrest matchers. We can also create a custom matcher and use it in our Spock specification. Let's create a custom matcher that will check if element...
Spocklight: Support for Hamcrest Matchers 14 May 2013 | 03:30 am
Spock has support for Hamcrest matchers and adds some extra syntactic sugar. In an expect: block in a Spock specification method we can use the following syntax value Matcher . Let's create a sample S...
Grails Goodness: Testing Views and Templates 13 May 2013 | 02:33 pm
${item}
Gradle Goodness: Running a Single Test 13 May 2013 | 03:07 am
We can run test code with Gradle using the test task that is added by the Java plugin. By default all tests found in the project are executed. If we want to run a single test we can use the Java syste...
Gradle Goodness: Show More Information About Failed Tests 10 May 2013 | 08:43 am
Running tests in Gradle is easy. Normally if one of the tests fails the build fails as well. But we don't see immediately in the command-line output why a test fails. We must first open the generated ...
IntelliJ IDEA Knows How to Format Spock where: Blocks 14 Apr 2013 | 08:57 pm
IntelliJ IDEA keeps amazing me. Last week I learned the code formatter of IntelliJ IDEA 12 supports Spock specific where: block formatting. Spock has great a great feature called data tables. We can d...

