New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests crash in Ant, but succeed in IntelliJ IDEA #2537
Comments
Hey @abbeycode , Could you try to modify your <dependencies>
<dependency org="junit" name="junit" rev="4.13.2"/>
<!-- Mockito and dependencies -->
<dependency org="org.mockito" name="mockito-inline" rev="4.2.0"/>
<dependency org="net.bytebuddy" name="byte-buddy" rev="1.12.6"/>
<dependency org="net.bytebuddy" name="byte-buddy-agent" rev="1.12.6"/>
<!-- <dependency org="org.objenesis" name="objenesis" rev="3.2"/>-->
</dependencies> (I had to comment |
I'm still curious why it worked in IntelliJ with the same JARs present, but this definitely fixed it. I was actually able to remove both explicit
|
@temp-droid Would you like to answer my question on Stack Overflow too, for any incumbent rep points, or shall I answer it myself? |
Hey @abbeycode , feel free to comment the answer on SO with your added information too :) |
I'm using Mockito to test the mock the static method of a dependency of the class under test, and the test passed while I was developing it in IntelliJ. Once I started running it in Ant on our CI server (and now locally), I'm getting failures. Below I've pasted the sample source files, the test file, the Ant script, and the Ivy dependencies file describing the versions of each library I'm using (all of them up to date at this time), followed by the verbose error I'm seeing.
But if I create these several files in a directory (with the two classes under
src/com/example
and the unit test undertests/com/example
and open it up as an IntelliJ IDEA project, using all the same dependencies (including JUnit) and run all tests, it succeeds. The only change from the standard module template is specifying the JDK path and Java level to 1.8. That's part of what's making it so puzzling. For what it's worth, Ant acts the same whether invoked from within IntelliJ IDEA's built-in Ant integration, or separately on the command line.Mockito: 4.2.0
Java: 1.8.0_312
IntelliJ IDEA: 2021.3
Ant: 1.10.12
OS: macOS 12.1, centOS 7
Here's a zip file with everything you need to run it. If you want to run it, you'll need Ant installed, and then run the command below to install Ivy:
(Stack Overflow cross-post)
BusinessClass.java
StaticDependency.java
BusinessClassTest.java
ivy.xml
build.xml
JUnit output
The text was updated successfully, but these errors were encountered: