简体   繁体   中英

Maven test fail on terminal but passes in IntelliJ

My Spring Boot application uses TestNG and it has the surefire plugin. I am attempting to package it on the terminal but it keeps failing on the maven test step. If I run the maven package command on IntelliJ, all the maven steps run fine and pass.

I am only getting errors like below when it is attempting to mvn test on the terminal/command line. What could it be? I thought it was a Mockito dependency issue but even after added it in my pom.xml nothing changed.

You can learn about inline mocks and their limitations under item #39 of the Mockito class javadoc.

Underlying exception : org.mockito.exceptions.base.MockitoException: Could not modify all classes [class java.lang.Object, class org.fluentd.logger.FluentLogger]
    at com.homedepot.appconfig.error.reporting.StackDriverErrorReporterTest.reportError_WithHttpRequest_False(StackDriverErrorReporterTest.java:112)
Caused by: org.mockito.exceptions.base.MockitoException: Could not modify all classes [class java.lang.Object, class org.fluentd.logger.FluentLogger]
    at com.homedepot.appconfig.error.reporting.StackDriverErrorReporterTest.reportError_WithHttpRequest_False(StackDriverErrorReporterTest.java:112)
Caused by: java.lang.IllegalStateException: 

Byte Buddy could not instrument all classes within the mock's type hierarchy

This problem should never occur for javac-compiled classes. This problem has been observed for classes that are:
 - Compiled by older versions of scalac
 - Classes that are part of the Android distribution
    at com.homedepot.appconfig.error.reporting.StackDriverErrorReporterTest.reportError_WithHttpRequest_False(StackDriverErrorReporterTest.java:112)
Caused by: java.lang.IllegalArgumentException
    at com.homedepot.appconfig.error.reporting.StackDriverErrorReporterTest.reportError_WithHttpRequest_False(StackDriverErrorReporterTest.java:112)
Mockito cannot mock this class:```


Check the maven version and pom.xml file it is picking to run the test; this is my wild guess.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM