将空 JSON 数组作为参数传递给 @JsonProperty 注释方法

Passing an empty JSON array as a parameter to an @JsonProperty annotated method

我正在尝试在我的负载中传递空数组值以进行 Rest Assured 测试,以便它包含:

{
  "areaCode": []
}

我有一个代表数据对象的 POJO:

@Data
public class AreaDetails {

//declare fields here
@JsonProperty("areaCode")
private JsonArray areaCode;

}

然后尝试在我的测试中设置值:

@Test
public void updateAreaCodes()  {

    a = new AreaCodes();

    //set other fields
    a.setDealerOptions(<PARAM>);

我不清楚在这里传递什么作为参数,或者我是否应该将该字段声明为 JsonArray

POJO :

@Data
public static class Example {

    @JsonProperty("areaCode")
    private List<Object> areaCode = null;

}

测试:

    Example e = new Example();
    e.setAreaCode(new JSONArray());

    String abc = new ObjectMapper().writerWithDefaultPrettyPrinter().writeValueAsString(e);
    System.out.println(abc);