I try to write integration test for domain classes in my project. However each time I run the test I got some errors.
My code is below:
class ProductIntegrationTest extends GroovyTestCase {
void testSave() {
def product = new Product(name: "phone")
product.save(flush: true, failOnError: true)
assert.....
}
}
After I run the test, the exception is:
groovy.lang.MissingMethodException: No signature of method: Product.save() is applicable for argument types: () values: []
Possible solutions: save(), save(boolean), save(java.util.Map), wait(), last(), any()
However, if I put a @TestFor(Product)
annotation for the domain class, the error has gone. I found in the document for integration test we can't put @TestFor
annotation because it is only for unit test.
Anyone get some idea?