我正在创建一个扩展CollaborativeFilterModel的匿名类。我想在train方法中返回matrixFactorizationModelMock,但无法解析。请注意,matrixFactorizationModelMock是在匿名类之外定义的。
class CollaborativeFilterTest extends FunSuite with EasyMockSugar {
test("Index mapping"){
val matrixFactorizationModelMock = mock[MatrixFactorizationModel]
//Start of anonymous class definition:
val model = new CollaborativeFilterModel(){
override def train(ratings: Dataset[Rating]): MatrixFactorizationModel = {
matrixFactorizationModelMock //Cannot resolve symbol matrixFactorizationModelMock
}
有什么建议吗?谢谢!
答案 0 :(得分:1)
matrixFactorizationModelMock
而不是matrixFactorizationModel
...