Skip to Content
6
Former Member
Dec 04, 2014 at 07:40 PM

bizarre ClassCastException in JUnit test.

502 Views

 @RunWith(HybrisJUnit4ClassRunner.class)
 @IntegrationTest
 @Transactional(noRollback = false)
 public class ProductConsolidationServiceTest extends ServicelayerTransactionalTest {
     @test
     public void test() {
         CatalogModel productCatalog = modelService.create(CatalogModel.class);
         MyProductModel p = modelService.create(MyProductModel.class);
     }
 }

The line that creates the CatalogModel works fine. The line that creates the MyProductModel throws a ClassCastException: java.lang.ClassCastException: de.hybris.platform.core.model.product.ProductModel cannot be cast to com.my.generated.core.model.MyProductModel

This line works fine in Master tenant, just not in JUnit tests.

Why is this happening?

Thanks