Your are not doing any thing in your service method, you can test it as
@TestFor(MySampleService)
class MySampleServiceSpec extends Specification {
def setup() {
}
def cleanup() {
}
void "test something"() {
when:
def result = service.spockTest()
then:
assert result == false
}
}
A service is generally used for database interaction, such as saving the data, lets take a simple example, following is my service method
Comment spockTest(String comment) {
Comment commentInstance = new Comment(comment: comment).save()
return commentInstance
}
then I generally test this as
@TestFor(MySampleService)
@Mock([Comment])
class MySampleServiceSpec extends Specification {
def setup() {
}
def cleanup() {
}
void "test something"() {
given:
Integer originalCommentCount = Comment.count()
when:
def result = service.spockTest('My Comment')
then:
assert originalCommentCount + 1 == Comment.count()
assert result.comment == "My Comment"
}
}
Where Comment is my domain class.
I run this test as grails test-app -unit MySampleServiceSpec