Details
-
Bug
-
Resolution: Fixed
-
High
-
3.2.0
-
None
Description
I have the following test stub (src/main/java)
public final class TestStub { TestStub() { throw new IllegalArgumentException(); } public static void getHandler() { new HashMap<>().computeIfAbsent(String.class, t -> new TestStub()); } }
And the following test (src/test/java)
public class FooTest { @Test(expected = IllegalArgumentException.class) public void test0() { TestStub.getHandler(); } }
Using maven It runs fine using "clean install" however using clover I get the following exception
java.lang.reflect.UndeclaredThrowableException at com.sun.proxy.$Proxy12.apply(Unknown Source) at java.util.HashMap.computeIfAbsent(HashMap.java:1118) at org.cakeframework.internal.container.TestStub.getHandler(TestStub.java:26) at org.cakeframework.internal.container.FooTest.test0(FooTest.java:29) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.ExpectException.evaluate(ExpectException.java:19) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:264) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:124) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103) Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.cakeframework.internal.container.TestStub$__CLR3_2_0wqwqhpd53be5$1.invoke(TestStub.java:20) ... 28 more Caused by: java.lang.IllegalArgumentException at org.cakeframework.internal.container.TestStub.<init>(TestStub.java:22) at org.cakeframework.internal.container.TestStub.lambda$getHandler$6(TestStub.java:26) at org.cakeframework.internal.container.TestStub$$Lambda$13/1227074340.apply(Unknown Source) ... 33 more
If I replace with a standard anonymous class implementing java.util.function.Function it runs fine