Groovy: isn’t there a stringToMap out of the box?

You might want to try a few of your scenarios using evaluate, it might do what you are looking for. def stringMap = “[‘a’:2,’b’:4]” def map = evaluate(stringMap) assert map.a == 2 assert map.b == 4 def stringMapNested = “[‘foo’:’bar’, baz:[‘alpha’:’beta’]]” def map2 = evaluate(stringMapNested) assert map2.foo == “bar” assert map2.baz.alpha == “beta”

Unzip Archive with Groovy

Maybe Groovy doesn’t have ‘native’ support for zip files, but it is still pretty trivial to work with them. I’m working with zip files and the following is some of the logic I’m using: def zipFile = new java.util.zip.ZipFile(new File(‘some.zip’)) zipFile.entries().each { println zipFile.getInputStream(it).text } You can add additional logic using a findAll method: def … Read more

Running spock unit tests with Maven

This answer is purely supplemental to @PeterNiederwieser’s answer. In it he mentions that you can configure the name pattern used by Surefire. Here is an example of what worked for me: <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.18</version> <configuration> <includes> <!– By default only files ending in ‘Test’ will be included, so also include support for Spock style … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)