title: Unit testing using ControllerUnitTestCase in Grails
body: <p>I have the following controller:</p>
  
  <pre><code>class MyController {
     def simple = {
        render "simple"
     }
  }
  </code></pre>
  
  <p>An respectively the following test case:</p>
  
  <pre><code>class MyControllerTests extends ControllerUnitTestCase {
     void testSimple() {
        controller.simple
        def body = controller.response.contentAsString
        assertEquals "simple", body
     }
  }
  </code></pre>
  
  <p>I would have expected this test to pass successfully. Surprisingly, it fails with the following result:</p>
  
  <pre><code>junit.framework.ComparisonFailure: null expected:&lt;[simple]&gt; but was:&lt;[]&gt;
  </code></pre>
  
  <p>I have run the application through the browser and works as expected (i.e. prints "simple).</p>
  
  <p>What am i missing here?</p>