}
@Test
public void test() throws Exception
{
SenseiRequest req = RequestConverter2.fromJSON(senseiRequestJson, null);
//testquery;
// assertTrue("query_string is not equal", req.getQuery().toString().equals("this AND that OR thus"));
//test paging;
assertTrue("offset is not correct", req.getOffset() == 0);
assertTrue("size is not correct", req.getCount() ==10);
//test group by;
assertTrue("group by is not correct", req.getGroupBy()[0].equals("category"));
assertTrue("max per group is not correct", req.getMaxPerGroup() == 3);
//test filters;
//test facets;
assertTrue("facet number is not correct", req.getFacetSpecCount() ==1);
assertTrue("facet category max", req.getFacetSpec("category").getMaxCount()==10);
assertTrue("facet category min", req.getFacetSpec("category").getMinHitCount()==1);
assertTrue("facet category expand", req.getFacetSpec("category").isExpandSelection() == false);
assertTrue("facet category order", req.getFacetSpec("category").getOrderBy()== FacetSortSpec.OrderHitsDesc);
//test facet initial parameters;
Map<String, FacetHandlerInitializerParam> mapParams = req.getFacetHandlerInitParamMap();
assertTrue("facet number is not correct", mapParams.size() ==1);
FacetHandlerInitializerParam param = mapParams.get("network");
boolean[] coldstart = param.getBooleanParam("coldStart");
evaluateBool(coldstart, new boolean[]{true});
List<String> names = param.getStringParam("names");
ArrayList<String> ar = new ArrayList<String>();
ar.add("a");
ar.add("b");
ar.add("c");
evaluateListString(names, ar);
double[] timeout = param.getDoubleParam("timeOut");
evaluateDouble(timeout, new double[]{2.4});
int[] srcId = param.getIntParam("srcId");
evaluateInt(srcId, new int[]{26609850});
long[] longId = param.getLongParam("longId");
evaluateLong(longId, new long[]{1234567890L, 9876543210L});
byte[] base64 = param.getByteArrayParam("binary");
evaluateBytes(base64, (new String("Hello world")).getBytes());
//test sortby;
assertTrue("first sort by is not correct", req.getSort()[0].getField().equals("color"));
assertTrue("first sort by order is not correct", req.getSort()[0].getReverse() == true);
assertTrue("secondary sort by is not correct", req.getSort()[1] == SortField.FIELD_SCORE);
//test fetchStored;
assertTrue("fetchStored is not correct", req.isFetchStoredFields() == false);
assertTrue("fetchStoredValue is not correct", req.isFetchStoredValue() == false);
//test fetchTermVectors;
// assertTrue("fetchTermVectors is not correct", req.getTermVectorsToFetch().size() ==0);
//test partitions;
assertTrue("partition test 1", req.getPartitions().contains(1));
assertTrue("partition test 2", req.getPartitions().contains(2));
assertTrue("partition size test", req.getPartitions().size() ==2);
//test explain;
assertTrue("explain test", req.isShowExplanation() == false);
//test routeParam;
assertTrue("routing parameter test", req.getRouteParam()!= null); // when it is a null, we get a rand int;
}