expectedExceptions mismatch because of wrapping (regression 7.0.0 to 7.1.0)
See original GitHub issueTestNG Version
7.1.0
Expected behavior
When the method under test throws an IllegalArgumentException, a test with expectedExceptions = IllegalArgumentException.class
passes.
Actual behavior
The test fails with:
FAILED: testConvertWrongNumberOfBytesToInts
org.testng.TestException:
Expected exception of type class java.lang.IllegalArgumentException but got org.testng.internal.InvokeMethodRunnable$TestNGRuntimeException: java.lang.IllegalArgumentException: Number of input bytes must be a multiple of 4.
at org.testng.internal.MethodRunner.runInSequence(MethodRunner.java:46)
at org.testng.internal.TestInvoker$MethodInvocationAgent.invoke(TestInvoker.java:816)
at org.testng.internal.TestInvoker.invokeTestMethods(TestInvoker.java:146)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:146)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:128)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.testng.internal.InvokeMethodRunnable$TestNGRuntimeException: java.lang.IllegalArgumentException: Number of input bytes must be a multiple of 4.
at org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:53)
at org.testng.internal.InvokeMethodRunnable.call(InvokeMethodRunnable.java:71)
at org.testng.internal.InvokeMethodRunnable.run(InvokeMethodRunnable.java:35)
at org.testng.internal.MethodInvocationHelper.invokeWithTimeoutWithNoExecutor(MethodInvocationHelper.java:314)
at org.testng.internal.MethodInvocationHelper.invokeWithTimeout(MethodInvocationHelper.java:280)
at org.testng.internal.TestInvoker.invokeMethod(TestInvoker.java:603)
... 9 more
Caused by: java.lang.IllegalArgumentException: Number of input bytes must be a multiple of 4.
at io.github.pr0methean.betterrandom.util.BinaryUtils.convertBytesToInts(BinaryUtils.java:104)
at io.github.pr0methean.betterrandom.util.BinaryUtilsTest.testConvertWrongNumberOfBytesToInts(BinaryUtilsTest.java:96)
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:498)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:134)
at org.testng.internal.InvokeMethodRunnable.runOne(InvokeMethodRunnable.java:47)
Is the issue reproductible on runner?
- Shell
- Maven
- Gradle
- Ant
- Eclipse
- IntelliJ
- NetBeans
Test case sample
Test: https://github.com/Pr0methean/BetterRandom/blob/6df10c5b6e8ec24dea4275bf2b487dd9aecdc369/betterrandom/src/test/java/io/github/pr0methean/betterrandom/util/BinaryUtilsTest.java#L93 Code under test throws the exception here: https://github.com/Pr0methean/BetterRandom/blob/ca5deaff0497db33d7769bdf697af9852389f151/betterrandom/src/main/java/io/github/pr0methean/betterrandom/util/BinaryUtils.java#L104
(This version of the test passes on TestNG 7.0.0.)
Issue Analytics
- State:
- Created 4 years ago
- Comments:5
Top Results From Across the Web
Changelog — pytest documentation
#9767: Fixed a regression in pytest 7.1.0 where some conftest.py files outside of the source tree (e.g. in the site-packages directory) were not...
Read more >Changelog — Finagle 22.4.0 documentation
However, in cases where this doesn't happen you can explicitly wrap them using Parameter.wrap . Runtime Behavior Changes¶. finagle-core: com.twitter.finagle.
Read more >VERSION.txt · Gitee 极速下载/Jetty - Gitee.com
jetty-7.1.0.v20100505. jetty-7.1.0.RC1 ... jetty-7.0.0.v20091005 ... + 7513 Getter/setter type mismatch for mbean attribute file in class.
Read more >CVS log for pkgsrc/devel/py-test/distinfo - NetBSD CVS Repositories
Fixed regression where ``--import-mode=importlib`` used together with :envvar:`PYTHONPATH` or :confval:`pythonpath` would cause import errors in test suites ...
Read more >Jetty: VERSION.txt - Fossies
onStartUp is not called with maven jar 382 packaging using Jetty Maven ... 542 + 4208 Regression in Jetty 9.4.21: 304 response with...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Pr0methean - The issue is reproducible when you run a testng suite that looks like below
The code path seems to be linked to enabling parallel execution, of a test method that has a time out defined and also has an expected exception.
Ok… I think I got the problem.
Here’s a sample that can be used to reproduce this issue