@@ -80,8 +80,8 @@ class MockSuite extends munit.FunSuite with MockFunctions {
80
80
81
81
// Polymorphic methods
82
82
// Fail to compile with 3.3.0
83
- // when(m.polymorphic _ ).expects(List(2)).returns("a1")
84
- // assertEquals(m.polymorphic(List(2)), "a1")
83
+ when[ List [ Int ], String ] (m.polymorphic).expects(List (2 )).returns(" a1" )
84
+ assertEquals(m.polymorphic(List (2 )), " a1" )
85
85
86
86
val javaObject = Object ()
87
87
when(() => m.polymorphicUnary).expects().returns(javaObject)
@@ -91,8 +91,8 @@ class MockSuite extends munit.FunSuite with MockFunctions {
91
91
assertEquals(m.polycurried(" a" )(2 ), " c" -> 6 )
92
92
93
93
// Fail to compile with 3.3.0
94
- // when(m.polymorphicParam).expects((1, 2.0)).returns("ok")
95
- // assertEquals(m.polymorphicParam((1, 2.0)), "ok")
94
+ when[( Int , Double ), String ] (m.polymorphicParam).expects((1 , 2.0 )).returns(" ok" )
95
+ assertEquals(m.polymorphicParam((1 , 2.0 )), " ok" )
96
96
97
97
98
98
// TODO Not supported yet
@@ -103,15 +103,13 @@ class MockSuite extends munit.FunSuite with MockFunctions {
103
103
// Scala 3 to let us do that.
104
104
105
105
// type bound methods
106
- // Fail to compile with 3.3.0
107
- // when(m.upperBound _).expects(TestException()).returns(1)
108
- // assertEquals(m.upperBound(TestException()), 1)
106
+ when[TestException , Int ](m.upperBound _).expects(TestException ()).returns(1 )
107
+ assertEquals(m.upperBound(TestException ()), 1 )
109
108
110
109
val animal = Animal ()
111
110
val dog = Dog ()
112
- // Fail to compile with 3.3.0
113
- // when(m.lowerBound).expects(animal, List(dog)).returns("ok")
114
- // assertEquals(m.lowerBound(animal, List(dog)), "ok")
111
+ when[Animal , List [Animal ], String ](m.lowerBound).expects(animal, List (dog)).returns(" ok" )
112
+ assertEquals(m.lowerBound(animal, List (dog)), " ok" )
115
113
116
114
// TODO with implementation methods
117
115
0 commit comments