我正在尝试运行一个非常简单的集成测试,并不断收到此错误:

Caused an ERROR
No signature of method: com.ra.EquipmentTests.assertNotNull() is applicable for argument types: (com.ra.equipment.Equipment) values: [com.ra.equipment.Equipment : 1]
groovy.lang.MissingMethodException: No signature of method: com.ra.EquipmentTests.assertNotNull() is applicable for argument types: (com.ra.equipment.Equipment) values: [com.ra.equipment.Equipment : 1]
    at com.ra.EquipmentTests.testSomething(EquipmentTests.groovy:27)

有问题的类(class)和测试:
    class Equipment {
    static hasMany = [pixes: Pix]
    static constraints = {
    }
}
class Pix {
    def Equipment equipment
    static belongsTo = [Equipment]
    static constraints = {
    }
}



class EquipmentTests {
    @Before
    void setUp() {
        // Setup logic here
    }

    @After
    void tearDown() {
        // Tear down logic here
    }

    @Test
    void testSomething() {
        def equipment = new Equipment()

        //assertNull equipment.pixes
        assertNotNull equipment.save()
    }
}

我正在使用Grails rc1和Groovy 1.7.8,因为所有这些都是令人尴尬的帮助,将不胜感激。

最佳答案

您的测试类(class)需要扩展grails / groovy测试类(class)之一,例如
GrailsUnitTestCaseGroovyTestCase

这是一些documentation

10-06 05:02