alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Groovy example source code file (Groovy1407_Bug.groovy)

This example Groovy source code file (Groovy1407_Bug.groovy) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Groovy tags/keywords

groovy1407_bug, groovy1407_bug, groovytestcase, groovytestcase

The Groovy Groovy1407_Bug.groovy source code

package groovy.bugs

class Groovy1407_Bug extends GroovyTestCase {
   void testGPathOnMultiKeyMap(){
      // each key is a two-element String list
      // each value is a two-element integer list
      def map = [['a','b']:[2,34],['c','d']:[2,16],['e','f']:[3,97],['g','h']:[4,48]]
      def expected = [["a", "b"],["c", "d"],["e", "f"],["g", "h"]]
      // previous returned value was [a, b, g, h, e, f, c, d]
      // i.e, expanded
      def actual = map.entrySet().key
      assert expected == actual
   }

   void testGPathOnMultiValueMap(){
      // each key is a two-element String list
      // each value is a two-element integer list
      def map = [['a','b']:[2,34],['c','d']:[2,16],['e','f']:[3,97],['g','h']:[4,48]]
      def expected = [[2, 34],[2, 16],[3, 97],[4, 48]]
      // previous returned value was [2, 34, 4, 48, 3, 97, 2, 16]
      // i.e, expanded
      def actual = map.entrySet().value
      assert expected == actual
   }
}

Other Groovy examples (source code examples)

Here is a short list of links related to this Groovy Groovy1407_Bug.groovy source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.