做自动化数据驱动的时候,我的这段代码在反序列化过程中必须要强制执行ACCEPT_SINGLE_VALUE_AS_ARRAY才行?如果没有加粗这段,我的代码就要报错。

static List search() throws IOException {
ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
mapper.enable(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY);
TypeReference typeReference = new TypeReference<List>() {
};
List keyword = (List) mapper.readValue(
ParamsTest.class.getResourceAsStream("/framework/search.yaml"),
typeReference);
return keyword;}

关闭