Skip to content

我的 Pojo 中的一个字段使用了 com.alibaba.fastjson.JSONObject 在 mock 的时候会抛数组越界异常 ArrayIndexOutOfBoundsException #62

Description

@doushichao
Exception in thread "main" com.github.jsonzou.jmockdata.MockException: java.lang.ArrayIndexOutOfBoundsException: 0
	at com.github.jsonzou.jmockdata.mocker.BeanMocker.mock(BeanMocker.java:47)
	at com.github.jsonzou.jmockdata.mocker.ClassMocker.mock(ClassMocker.java:38)
	at com.github.jsonzou.jmockdata.mocker.BaseMocker.mock(BaseMocker.java:35)
	at com.github.jsonzou.jmockdata.JMockData.mock(JMockData.java:33)

我使用了如下的拦截器都是不生效的

mockConfig.registerBeanMockerInterceptor(JSONObject.class, (aClass, field, o, dataConfig) -> InterceptType.UNMOCK);
public class JSONObjectMock implements Mocker<JSONObject> {
    @Override
    public JSONObject mock(DataConfig dataConfig) {
        return new JSONObject();
    }
}

mockConfig.registerMocker(new JSONObjectMock(), JSONObject.class);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions