title: Grails unit test of domain class (gorm)
body: <p>Started playing with grails and I want to evaluate GORM, so I created a domain class using Spring Tool Suite: <code>Client</code> with <code>name</code>, <code>vatNumber</code>, and <code>regNumber</code> and the test class was created automatically.</p>
  
  <p>The code for unit test I added is :</p>
  
  <pre><code>package pilot1
  
  import grails.test.*
  
  class ClientTests extends GrailsUnitTestCase {
      protected void setUp() {
          super.setUp()
      }
  
      protected void tearDown() {
          super.tearDown()
      }
  
      void testSomething() {
          def instances = []
          def myTestDomain = mockDomain(Client, instances)
          def client = new Client(name:"Test",vatNumber:"323",regNumber:"343")
          client.id =1;
          assertEquals client.name, "Test"
          client.save();
          def res = Client.findByName("Test")
          println instances
          println res
          //assertEquals 1, instances.size()
      }
  }
  </code></pre>
  
  <p>The results are [] and null! What did I do wrong?</p>
  
  <p>Also, I would like also to see the SQL generated by GORM (Hibernate) behind the scenes. Any idea how I might do that in Grails ?</p>