Java 找不到内容类型为application/json的MessageBodyReader

Java 找不到内容类型为application/json的MessageBodyReader,java,unit-testing,testing,resteasy,Java,Unit Testing,Testing,Resteasy,我有一个RestEasy客户端,它从rest端点获取数据。这个测试看起来像 @Test public void testGetAllVariablesWithoutQueryParamPass() throws Exception { final ClientRequest clientCreateRequest = new ClientRequest("http://localhost:9090/variables"); final Multiv

我有一个
RestEasy
客户端,它从rest端点获取数据。这个测试看起来像

    @Test
    public void testGetAllVariablesWithoutQueryParamPass() throws Exception {
        final ClientRequest clientCreateRequest = new ClientRequest("http://localhost:9090/variables");
        final MultivaluedMap<String, String> formParameters = clientCreateRequest.getFormParameters();
        final String name = "testGetAllVariablesWithoutQueryParamPass";
        formParameters.putSingle("name", name);
        formParameters.putSingle("type", "String");
        formParameters.putSingle("units", "units");
        formParameters.putSingle("description", "description");
        formParameters.putSingle("core", "true");

        final GenericType<List<VariablePresentation>> typeToken = new GenericType<List<VariablePresentation>>() {
        };
        final ClientResponse<List<VariablePresentation>> clientCreateResponse = clientCreateRequest.post(typeToken);
        assertEquals(201, clientCreateResponse.getStatus());
        final List<VariablePresentation> variables = clientCreateResponse.getEntity();
        assertNotNull(variables);
        assertEquals(1, variables.size());

    }

在添加maven依赖项之后

<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jackson-provider</artifactId>
    <version>3.0-beta-2</version>
</dependency>

还有一个后续问题

您是否使用Maven管理您的应用程序?您需要在类路径中使用RESTEasy Jackson提供程序。太好了。请确认您对resteasy jackson provider有依赖关系。我刚刚添加了它,现在正在运行
mvn clean install
如果失败,我添加了更新与resteasy客户端相同的问题:重建对象()
<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-jackson-provider</artifactId>
    <version>3.0-beta-2</version>
</dependency>
testGetAllVariablesWithoutQueryParamPass(com.myorg.project.market.integration.TestVariable): org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.util.ArrayList out of START_OBJECT token(..)

Tests run: 9, Failures: 0, Errors: 1, Skipped: 1