final String jsonPathTmpl = "$.data[?(@.run == %s)]";
runTest("JsonPath[String]", new Function<Integer, Tuple2<Selector, Object>>() {
@Override
public Tuple2<Selector, Object> apply(Integer i) {
Selector sel = J(String.format(jsonPathTmpl, i));
String json = String.format(jsonTmpl, i);
return Tuple.<Selector, Object>of(sel, json);
}
});
runTest("JsonPath[POJO]", new Function<Integer, Tuple2<Selector, Object>>() {
@Override
public Tuple2<Selector, Object> apply(Integer i) {
Selector sel = J(String.format(jsonPathTmpl, i));
DataNode node = new DataNode(new DataNode.Run(i));
return Tuple.<Selector, Object>of(sel, node);
}
});
runTest("JsonPath[Map]", new Function<Integer, Tuple2<Selector, Object>>() {
@Override
public Tuple2<Selector, Object> apply(Integer i) {
Selector sel = J(String.format(jsonPathTmpl, i));
String json = String.format(jsonTmpl, i);
Object key;
try {
key = mapper.readValue(json, Map.class);
} catch(IOException e) {
throw new IllegalStateException(e);
}
return Tuple.<Selector, Object>of(sel, key);
}
});
runTest("JsonPath[Tree]", new Function<Integer, Tuple2<Selector, Object>>() {
@Override
public Tuple2<Selector, Object> apply(Integer i) {
Selector sel = J(String.format(jsonPathTmpl, i));
String json = String.format(jsonTmpl, i);
Object key;
try {
key = mapper.readTree(json);
} catch(IOException e) {