Internal error E009: Unrecoverable runtime error (Exception: java.lang.NoSuchMethodError)

Hi, I’m running some tests with Diffblue, but I’m having problems with a simple test and I would like to understand the reason for the error.

My test is:

public void testMyObjectGroup(MyObject myObject){
	if(myObject.getName().equalsIgnoreCase("OBJECT_NAME_1")){
		System.out.println("OBJECT_NAME_1");
		myObject.setName("OBJECT_NAME_1_TEST");
	} else if(myObject.getName().equalsIgnoreCase("OBJECT_NAME_2")){
		System.out.println("OBJECT_NAME_2");
		myObject.setName("OBJECT_NAME_2_TEST");
	} else {
		System.out.println("OBJECT_NAME_DEFAULT");
		myObject.setName("OBJECT_NAME_DEFAULT_TEST");
	}
}


public class MyObject {

	private String name;
	private String type;
	private List<MyObject> childObjects;
	
	... respective getter and setter methods ...
}

If I add the jersey-common dependency in my project, an error occurs when generating the tests and the following message is displayed: “Unrecoverable runtime error: Please contact Diffblue support. See https://diff.blue/E009”. If I remove this dependency, the tests are successfully generated.

An important detail is that this behavior only occurs because my class MyObject has a list of MyObject. If I remove this attribute, the tests are successfully generated, even with the dependency mentioned above added.

Additional Information:
OS: Windows 10 Enterprise, 64bit
Java: jdk1.8.0_291
IntelliJ IDE 2021.1 with Diffblue Community Edition plugin
JUnit 4.12

Dependency with problem:

<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-common</artifactId>
<version>2.7</version>
<scope>test</scope>
</dependency>

Error in cover-plugin.log
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] Encountered an internal error E009: Unrecoverable runtime error
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] Details: Exception: java.lang.NoSuchMethodError: org.mockito.MockSettings.stubOnly()Lorg/mockito/MockSettings;
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] Stack trace:
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > java.lang.NoSuchMethodError: org.mockito.MockSettings.stubOnly()Lorg/mockito/MockSettings;
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.spring.isolation.framework.mocks.MockUtils.createStub(MockUtils.java:39)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.mockito.isolation.MockitoProxyImpl.stub(MockitoProxyImpl.java:33)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.a.d.d(SourceFile:462)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.d.a(SourceFile:32570)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.c.e.c.a(SourceFile:37)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.e.a(SourceFile:202)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.e.a(SourceFile:130)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.fuzztest.b.d.a(SourceFile:509)
18:01:51.296 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.cover.sandbox.execution.TimedCallableExecutor$CallableFuture.executeTask(SourceFile:30)
18:01:51.297 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.cover.sandbox.execution.TimedExecutor$TaskQueueRunner.run(SourceFile:83)
18:01:51.297 [INFO][analyzer-service:grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.cover.sandbox.execution.WorkerThread.run(SourceFile:198)

Error in cover-server.log
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] Encountered an internal error E009: Unrecoverable runtime error
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] Details: Exception: java.lang.NoSuchMethodError: org.mockito.MockSettings.stubOnly()Lorg/mockito/MockSettings;
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] Stack trace:
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > java.lang.NoSuchMethodError: org.mockito.MockSettings.stubOnly()Lorg/mockito/MockSettings;
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.spring.isolation.framework.mocks.MockUtils.createStub(MockUtils.java:39)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.mockito.isolation.MockitoProxyImpl.stub(MockitoProxyImpl.java:33)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.a.d.d(SourceFile:462)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.d.a(SourceFile:32570)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.c.e.c.a(SourceFile:37)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.e.a(SourceFile:202)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.tir.a.e.a(SourceFile:130)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.fuzztest.b.d.a(SourceFile:509)
18:01:51.296 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.cover.sandbox.execution.TimedCallableExecutor$CallableFuture.executeTask(SourceFile:30)
18:01:51.297 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.cover.sandbox.execution.TimedExecutor$TaskQueueRunner.run(SourceFile:83)
18:01:51.297 [INFO][grpc-default-executor-0][c.d.cover.c.b] > com.diffblue.cover.sandbox.execution.WorkerThread.run(SourceFile:198)

Hi there

Do you have Mockito in your pom.xml? It looks like we are trying to mock methods but cannot do that without mockito in the classpath.

Regards

andy

Yes, the mockito dependency is included in pom.xml and, apparently, Diffblue correctly loads that lib into the classpath.

    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-core</artifactId>
        <version>1.9.5</version>
        <scope>test</scope>
    </dependency>

cover-plugin.log

18:01:34.915 [INFO][pool-4-thread-68][c.d.c.analysis.b] Driver Builder configuration:
Active analysis engines: [ESSENTIAL_TESTS]
Module: ProjectTests-core
Classpath: C:\git\ProjectTests\ProjectTests-core\target\test-classes;C:\git\ProjectTests\ProjectTests-core\target\classes;C:\Users\jean.santolin.m2\repository\junit\junit\4.12\junit-4.12.jar;C:\Users\jean.santolin.m2\repository\org\mockito\mockito-core\1.9.5\mockito-core-1.9.5.jar;C:\Users\jean.santolin.m2\repository\org\hamcrest\hamcrest-core\1.1\hamcrest-core-1.1.jar;C:\Users\jean.santolin.m2\repository\org\objenesis\objenesis\1.0\objenesis-1.0.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\jersey\core\jersey-common\2.7\jersey-common-2.7.jar;C:\Users\jean.santolin.m2\repository\javax\ws\rs\javax.ws.rs-api\2.0\javax.ws.rs-api-2.0.jar;C:\Users\jean.santolin.m2\repository\javax\annotation\javax.annotation-api\1.2\javax.annotation-api-1.2.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\jersey\bundles\repackaged\jersey-guava\2.7\jersey-guava-2.7.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\hk2\hk2-api\2.2.0\hk2-api-2.2.0.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\hk2\hk2-utils\2.2.0\hk2-utils-2.2.0.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\hk2\external\aopalliance-repackaged\2.2.0\aopalliance-repackaged-2.2.0.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\hk2\external\javax.inject\2.2.0\javax.inject-2.2.0.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\hk2\hk2-locator\2.2.0\hk2-locator-2.2.0.jar;C:\Users\jean.santolin.m2\repository\org\javassist\javassist\3.18.1-GA\javassist-3.18.1-GA.jar;C:\Users\jean.santolin.m2\repository\org\glassfish\hk2\osgi-resource-locator\1.0.1\osgi-resource-locator-1.0.1.jar
Index: C:\Users\jean.santolin.diffblue\index\ProjectTests-4fed429ffb756721f122fb58df0cc1ba363c65e456d1f7eb753bb708b063ec3d

Hi Jean
We put together an example that looks like your example but does not fail - does it work for you? Can you see anything about your configuration that is different that might be causing the failure?

Here is the example CE.zip (9.2 KB)

Regards

andy

Hi Andy_Piper,

The example you sent generated the tests successfully. The only change I made was to change the properties of pom.xml to Java 8, because I don’t have Java 11 and I use Java 8.

Comparing your project version with my project version, I found 3 differences that make the error occur.

For testing purposes only, I applied these differences to your project and the error also occurred.

1 - In pom.xml I explicitly added the mockito-core dependency.
2 - In the MyObject class I added the getters and setters methods for all the attributes of the class.
3 - I moved the class out of the package, that is, I left it directly in the main / java folder.

If I return any of these 3 items to the original value, the tests will work again.

Hi Jean,

Thanks for the update!

I’ve noticed that you are using Mockito 1.9.5, unfortunately we don’t support that version of Mockito yet - we require Mockito 2.x, are you able to try with a newer version of Mockito? We will support older versions of Mockito in an upcoming release.

Regards

andy

Thanks for your help.

I tested with Mockito version 2.28.2 and worked correctly.

Great! Let us know if you need any further help.

Regards

andy