diff --git a/jvm/src/test/scala/com.paulbutcher.test/mock/JavaMocksTest.scala b/jvm/src/test/scala/com.paulbutcher.test/mock/JavaMocksTest.scala index e64af7be..a4a6dd6f 100644 --- a/jvm/src/test/scala/com.paulbutcher.test/mock/JavaMocksTest.scala +++ b/jvm/src/test/scala/com.paulbutcher.test/mock/JavaMocksTest.scala @@ -31,9 +31,10 @@ class JavaMocksTest extends IsolatedSpec { m.simpleMethod("two") shouldBe 42 } - /* + it should "mock classes with bridged methods" in { - val m = mock[JavaClassWithBridgeMethod] + class JavaClassWithBridgeMethodExtended extends JavaClassWithBridgeMethod + val m = mock[JavaClassWithBridgeMethodExtended] (m.compare _).expects(Integer.valueOf(5)).returning(1) (m.compare _).expects(Integer.valueOf(6)).returning(2) @@ -44,7 +45,7 @@ class JavaMocksTest extends IsolatedSpec { assertResult(1) { m.compare(Integer.valueOf(5)) } // calls: int compare(Integer) assertResult(2) { useBridgeMethod(m, Integer.valueOf(6)) } // calls: int compare(Object) - }*/ + } //! TODO - this is going to have to wait for macro types for a proper solution // "cope with Java methods with repeated parameters" in { @@ -75,44 +76,52 @@ class JavaMocksTest extends IsolatedSpec { m.polymorphicMethod(arg) shouldBe "foo" } - /* it should "mock a Java class with an overloaded method (different param count)" in { // test for issue #34 - val m = mock[JavaClassWithOverloadedMethod] + class JavaClassWithOverloadedMethodExtended extends JavaClassWithOverloadedMethod + + val m = mock[JavaClassWithOverloadedMethodExtended] (m.overloadedMethod(_: String)).expects("a").returning("first") (m.overloadedMethod(_: String, _: String)).expects("a", "b").returning("second") m.overloadedMethod("a") shouldBe "first" m.overloadedMethod("a", "b") shouldBe "second" - }*/ - /* + } + it should "mock a Java class with an overloaded method (the same param count)" in { // test for issue #73 - val m = mock[JavaClassWithOverloadedMethod] + class JavaClassWithOverloadedMethodExtended extends JavaClassWithOverloadedMethod + + val m = mock[JavaClassWithOverloadedMethodExtended] (m.overloadedSameParamCount(_: String)).expects("one").returning("first") (m.overloadedSameParamCount(_: Integer)).expects(Integer.valueOf(2)).returning(2) m.overloadedSameParamCount("one") shouldBe "first" m.overloadedSameParamCount(2) shouldBe 2 - }*/ + } + - /* it should "mock a Java class with an overloaded method (with primitive param)" in { // test for issue #73 - val m = mock[JavaClassWithOverloadedMethod] + class JavaClassWithOverloadedMethodExtended extends JavaClassWithOverloadedMethod + + val m = mock[JavaClassWithOverloadedMethodExtended] + (m.overloadedWithPrimitiveParam(_: String)).expects("one").returning("first") (m.overloadedWithPrimitiveParam(_: Int)).expects(2).returning("second") m.overloadedWithPrimitiveParam("one") shouldBe "first" m.overloadedWithPrimitiveParam(2) shouldBe "second" - }*/ + } + - /* it should "mock a Java class with an overloaded method (with type params)" in { - val m = mock[JavaClassWithOverloadedMethod] + class JavaClassWithOverloadedMethodExtended extends JavaClassWithOverloadedMethod + + val m = mock[JavaClassWithOverloadedMethodExtended] (m.overloadedGeneric(_: String)).expects("one").returning("first") - (m.overloadedGeneric(_: Int)).expects(2).returning("second") + (m.overloadedGeneric(_: Integer)).expects(Integer.valueOf(2)).returning("second") m.overloadedGeneric("one") shouldBe "first" m.overloadedGeneric(2) shouldBe "second" - }*/ + } override def newInstance = new JavaMocksTest } \ No newline at end of file