cancel
Showing results for 
Search instead for 
Did you mean: 

Issue on webtests with SAP Commerce 2205P1

nihil
Explorer
2,248

We have an issue on our web tests with the newest 2205P1 Upgrade of SAP Commerce when running

ant allwebtests -Dtestclasses.suppress.junit.tenant=true


The tests are randomily failing due to an Mockito mocking error exceptions(see below). Running the same test again via the same ant command is then succeeding without any code change.

So the result of the tests is just random and not deterministic (sometimes they fail, sometimes not)

It might be due to some classpath issue? Was anything changed in the 2205P1 regarding that and tests? Running the same tests with no code change on 2205P0, all tests are always successful.

<code>java.lang.NoClassDefFoundError: Could not initialize class org.mockito.codegen.ReturnService$MockitoMock$1335712202
	at jdk.internal.reflect.GeneratedSerializationConstructorAccessor2.newInstance(Unknown Source)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
	at org.objenesis.instantiator.sun.SunReflectionFactoryInstantiator.newInstance(SunReflectionFactoryInstantiator.java:48)
	at org.objenesis.ObjenesisBase.newInstance(ObjenesisBase.java:73)
	at org.mockito.internal.creation.instance.ObjenesisInstantiator.newInstance(ObjenesisInstantiator.java:22)
	at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.doCreateMock(InlineDelegateByteBuddyMockMaker.java:372)
	at org.mockito.internal.creation.bytebuddy.InlineDelegateByteBuddyMockMaker.createMock(InlineDelegateByteBuddyMockMaker.java:330)
	at org.mockito.internal.creation.bytebuddy.InlineByteBuddyMockMaker.createMock(InlineByteBuddyMockMaker.java:58)
	at org.mockito.internal.util.MockUtil.createMock(MockUtil.java:53)
	at org.mockito.internal.MockitoCore.mock(MockitoCore.java:84)
	at org.mockito.Mockito.mock(Mockito.java:1954)

View Entire Topic
Igor_Zarvanskyi
Newcomer
0 Kudos

Recently had a similar issue on newly assigned project. Ther root cause is in InlineDelegateByteBuddyMockMaker, which should be replaced with ProxyMockMaker. You can read in this article how to do that https://clutcher.github.io/post/hybris/fix_mockito_codegen_issue/

SAP Commerce Cloud SAP Commerce