title: How to mock values in Config.groovy in Grails for unit testing
body: <p>I want to write some test cases where I have to mock some properties of the config file.</p>
  
  <p>Below shown is the actual code</p>
  
  <pre><code>if (password.length() &lt; grailsApplication.config.user.password.min.length) {
      return false
  }
  </code></pre>
  
  <p>I want to mock <code>grailsApplication.config.user.password.min.length</code>
  In my config file, <code>user.password.min.length</code> has been set as <code>6</code></p>
  
  <p>I tried to mock in the following ways:</p>
  
  <ol>
  <li><p><code>mockConfig = new ConfigObject()</code><br>
      <code>mockConfig.user.password.min.length = 6</code></p></li>
  <li><p><code>mockConfig("user.password.min.length")</code></p></li>
  <li><code>mockConfig(user.password.min.length)</code></li>
  <li><code>mockConfig(mockConfig.user.password.min.length)</code></li>
  </ol>
  
  <p>But none of this is working. My code is throwing <code>NullPointerException</code> sometimes. 
  Could someone please advise the correct way to mock the config file?</p>