cancel
Showing results for 
Search instead for 
Did you mean: 

OrderPopulatorTest in commercefacades fails

Former Member
0 Kudos

we are working with Hybris 5.6 and now some unittests of commercefacades fail:

OrderPopulatorTest OrderHistoryPopulatorTest

with org.mockito.exceptions.base.MockitoException: Cannot mock/spy class de.hybris.platform.core.enums.OrderStatus Mockito cannot mock/spy following: - final classes - anonymous classes - primitive types at de.hybris.platform.commercefacades.order.converters.populator.OrderPopulatorTest.testConvert(OrderPopulatorTest.java:121)

I'm not sure if this an issue of Hybris 5.6 or it was there before. Anyway, we wan't to run all unittests on the Jenkins.. Any ideas/shelp on that?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

One of my colleagues finally found the problem: We have configured a new value for the item "OrderStatus" that way:

       <enumtype code="OrderStatus" autocreate="false" generate="true">
         <value code="APPROVED"/>
     </enumtype>

And at the first glance nothing's really bad with that, ok? But we have forgotten to declare dynamic="true" which lets Hybris generate a real enum class for OrderStatus and this finally cannot be mocked! So, the solution is:

       <enumtype code="OrderStatus" autocreate="false" generate="true" dynamic="true">
         <value code="APPROVED"/>
     </enumtype>

and Hybris then generates a real Java class

Thanks to Simon

Answers (0)