Created
August 21, 2015 12:57
-
-
Save PiotrZakrzewski/459e380e560d3dca5ce0 to your computer and use it in GitHub Desktop.
GitHub Grails Config Exception snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package mypackage | |
import grails.test.mixin.TestFor | |
import grails.test.mixin.TestMixin | |
import grails.test.mixin.support.GrailsUnitTestMixin | |
import spock.lang.* | |
/** | |
* See the API for {@link grails.test.mixin.support.GrailsUnitTestMixin} for usage instructions | |
*/ | |
@TestFor(mypackage.MyClass) | |
class MyClassSpec extends Specification { | |
def setup() { | |
} | |
def cleanup() { | |
} | |
void "test myMethod method"() { | |
given:"list " | |
def myClassInstance = new MyClass() | |
def listOfmaps = [ | |
[ | |
"a": [ | |
"id": 12345, | |
"field":"bla" | |
], | |
"b": "path", | |
"c": 1 | |
], | |
[ | |
"a": [ | |
"id": 54321, | |
"field":"blur" | |
], | |
"b": "path", | |
"c": null | |
] ] | |
when: "Call myMethod on it" | |
def result = myClassInstance.toTsv(listOfMaps) | |
then: "result is list of three strings and each has 11 tab separated values" | |
result.size() == 3 | |
result[0].split("\t").size() == 10 | |
result[1].split("\t").size() == 10 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment