我正在尝试创建一个简单的Junit测试。这个想法是我将Person对象状态存储在test / resources文件夹中的json中,因为所有开发人员都可以更轻松地访问它,而不必将其添加到本地mongoDB
import java.io.FileInputStream;
import java.io.IOException;
import org.junit.Test;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.hyperaspect.tex.domain.Statement;
public class fundsTest extends Test {
@Test
public void validateIndividualAndMoney() throws IOException {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
FileInputStream fileStream = new FileInputStream("src/test/resources/PeterStatementTest.json");
Person peter = mapper.readValue(fileStream, Person.class);
fileStream.close();
}
}
我之前已经与其他对象成功完成了此操作。我只是从json文件中读取并从中创建一个对象,但是现在出现异常
java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
Caused by: java.lang.ClassNotFoundException: net.bytebuddy.dynamic.loading.ClassLoadingStrategy