私はGrailsの初心者です..ユニットテストケースを書くことを学んでいます
私は2つのドメインを持っています
class Employee {
String name
String department
static hasOne =[address: Address]
public String toString() {
name
}
}
class Address {
String line1
String line2
Employee employee
static constraints = {
}
}
ここに私のAddressControllerTest.groovyがあります
void testSave() {
def address = new Address(line1: "Kaser Road", line2: "Bridage Town")
.addToEmployee(new Employee(name: "monda", department:"IT")).save()
controller.save()
assert model.addressInstance != null
}
エラーレポートを提供します
No signature of method: trip.side.Address.addToEmployee() is applicable for argument types: (trip.side.Employee) values: [monda] Possible solutions: setEmployee(trip.side.Employee), getEmployee()
groovy.lang.MissingMethodException: No signature of method: trip.side.Address.addToEmployee() is applicable for argument types: (trip.side.Employee) values: [monda]
Possible solutions: setEmployee(trip.side.Employee), getEmployee()
at trip.side.AddressControllerTests.testSave(AddressControllerTests.groovy:41)
誰かが私にそれを行う正しい方法を提案できますか。