Error occurred during initialization of VM java/lang/NoClassDefFoundError: java/lang/Object
This is the error I received while running the test Case.
This is the file.
package com.shanu.shopbackend.test; import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import com.shanu.shopbackend.dao.CategoryDAO; import com.shanu.shopbackend.dto.Category; public class CategoryTestCases { private static AnnotationConfigApplicationContext context; private static CategoryDAO categoryDAO; private Category category; @BeforeClass public static void init(){ context = new AnnotationConfigApplicationContext(); context.scan("com.shanu.shopbackend"); context.refresh(); categoryDAO= (CategoryDAO)context.getBean("categoryDAO"); } @Test public void testAddCategory() { category = new Category(); category.setName("Test Mobile"); category.setDescription("Mobile Descp"); category.setImageURL("CAT_2.png"); assertEquals("Succesfully Added a Category",true,categoryDAO.add(category)); } }
For Certain Test Case, I found that Environment Variable setting is null.