Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object
Это ошибка, полученная при выполнении тестового примера.
Это файл.
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));
}
}
Для некоторых тестовых случаев я обнаружил, что значение параметра Переменная среды равноnull.
Тестовый набор Junit