title: Groovy usage of named arguments
body: <p>I have a groovy method like this</p>
  
  <pre><code>def createMyObj(id,instanceId,isValid) {
  
     def myObj = new SomeObj()
     myObj.setId(id)
     myObj.setInstanceId(instanceId)
     myObj.isValid(isValid)
  
     myObj
  
  }
  </code></pre>
  
  <p>I have tests around this when I explicitly do this in the test it works perfectly fine.</p>
  
  <pre><code>def testObj = createMyObj(10,20,true)
  </code></pre>
  
  <p>when I tried to use named arguments like this.</p>
  
  <pre><code>def testObj = createMyObj(id:10,instanceId:20,isValid:true)
  </code></pre>
  
  <p>it's giving me this exception </p>
  
  <pre><code> No signature of method:createMyObj is applicable for argument types: (java.util.LinkedHashMap) values [[id:10, instanceId:20,..]]
  </code></pre>
  
  <p>I went to this <a href="http://groovy.codehaus.org/Extended+Guide+to+Method+Signatures" rel="noreferrer">page</a> to understand the concept a little further and I saw this piece of snippet.</p>
  
  <p>In case of <code>def foo(T t, p1, p2, ..., pn)</code> all named arguments will be in t, but that also means that you can not make a method call where you access pi by name. Example</p>
  
  <pre><code>def foo(x,y){}
  foo(x:1,y:2)
  </code></pre>
  
  <p>This code will fail at runtime, because the method foo expects two arguments, but the map you gave is only one argument.</p>
  
  <p>I am not sure if it's the cause of the error I am facing. If it expects two arguments like it says what is the argument that i am missing or how do I pass the second argument?</p>