weirddev

Open full view…

TestMe generates uncompilable code - Ambiguous method call

intars
Tue, 06 Jun 2017 13:16:08 GMT

Take a simple method that returns Double and "TestMe with Junit4+Mockito" and the generated JUnit test uses double primitive type 0d constant that causes this issue. Assert.assertEquals(0d, result); Error:(235, 15) java: reference to assertEquals is ambiguous both method assertEquals(java.lang.Object,java.lang.Object) in org.junit.Assert and method assertEquals(double,double) in org.junit.Assert match 0d should be wrapped in Double class or the result should call result.doubleValue()

Yaron
Wed, 07 Jun 2017 20:31:08 GMT

Thanks for reporting this. Good catch :). I've uploaded an EAP bugfix release to address this - v1.5.1. Will include this fix in the next stable release as well if there's no negative side effects. This change adds some verbosity when params that can be unboxed are passed as method call arguments. Currently its too complicated to separate these two use cases and I think the use case you raised is more important to address. Bugfix version 1.5.1 can be downloaded from the release page and installed offline: http://weirddev.com/testme/release-notes/. For reference, offline installation instructions: http://weirddev.com/testme/ (Under Installations, Option #2)

intars
Tue, 13 Jun 2017 14:55:18 GMT

Thanks, works great in version 1.5.1

Yaron
Thu, 15 Jun 2017 10:29:55 GMT

Thanks for the update :)