title: How to test with DomainUnitTest when multiTenancy
body: <p>How do test domain classes when I use multiTenancy?</p>
  
  <p>I can see that I need to extend with HibernateSpec and overwrite getConfiguration.</p>
  
  <p>This goes okay when I use ServiceUnitTest but not for DomainUnitTest</p>
  
  <p>Simple example:
  application.yml is setup with:</p>
  
  <pre><code>grails:
      gorm:
          multiTenancy:
              mode: DISCRIMINATOR
              tenantResolverClass: security.CompanyTenantResolver
  </code></pre>
  
  <p>My test:</p>
  
  <pre><code>class TestSpec extends HibernateSpec implements DomainUnitTest&lt;Test&gt;{
      void "expect ok test"() {
          expect:
          true
      }
      def setup() {
          System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, 'unit-test')
      }
  
      def cleanup() {
          System.setProperty(SystemPropertyTenantResolver.PROPERTY_NAME, '')
      }
  
  
      @Override
      Map getConfiguration() {
          [(Settings.SETTING_MULTI_TENANT_RESOLVER_CLASS): SystemPropertyTenantResolver]
      }
  
  }
  </code></pre>
  
  <p>No matter what I try i get:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.grails.beans.ConstraintsEvaluator': Cannot resolve reference to bean 'grailsDomainClassMappingContext' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'grailsDatastore': Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.grails.datastore.mapping.simple.SimpleMapDatastore]: Constructor threw exception; nested exception is org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.lang.String] to type [java.lang.Class&lt;?&gt;]
  </code></pre>
  
  <p>Is it a error in grails or have forgotten something?</p>