使用版本3.0.1,尝试模拟以下函数:
(cycleCollapseMock.collapseCycles[RoomVertex, UnDiEdge] _) expects(dummyGraph) returns(graph) once()
结果是一个类强制转换异常,其中MockFunction2被转换为MockFunction1。我假设这是因为RoomVertex需要一个classtag,它会被编译器转换为隐式参数。是否有可能为此隐含设定期望?
更新:这有效:
(cycleCollapseMock.collapseCycles[RoomVertex, UnDiEdge](_: Graph[RoomVertex, UnDiEdge])(_: ClassTag[RoomVertex])) expects(dummyGraph, classTag[RoomVertex]) returns(graph) once()