Skip to content

Instantly share code, notes, and snippets.

@PiotrZakrzewski
Created August 21, 2015 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PiotrZakrzewski/459e380e560d3dca5ce0 to your computer and use it in GitHub Desktop.
Save PiotrZakrzewski/459e380e560d3dca5ce0 to your computer and use it in GitHub Desktop.
GitHub Grails Config Exception snippet
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