title: access groovy map by dynamic key
body: <p>I want a construct a groovy map with dynamic key as below, and want to get the value by dynamic key. But I am not able to access it, it returns null for the same key.</p>
  
  <pre><code>class AmazonPackage {
      public static String WEIGHT = "WEIGHT"
  }
  
  class PackageTests {
  
     @Test
     void "map should return value by dynamic key" () {
         def map = [ ("${AmazonPackage.WEIGHT}") : 100, "id": "package001"]
  
         assert map['id'] == "package001"
  
         //assert map[("${AmazonPackage.WEIGHT}")] == 100
         //assert map."${AmazonPackage.WEIGHT}" == 100
  
         assert 2 == map.keySet().size()
         assert map."WEIGHT" == 100 //fails
      }
  
      @Test
      void "map should return value by simple key" () {
          def map = ["w" : 100]
          assert map."w" == 100
      }
  
  }
  </code></pre>
  
  <p>Failure I get is, </p>
  
  <pre><code>Assertion failed: 
  
  assert map."WEIGHT" == 100
         |   |        |
         |   null     false
         [WEIGHT:100, id:package001]
  </code></pre>