QueryEvaluatorSet { public CompOpEvaluator getCompOpEvaluator(QueryExprCompare filterCompare) { if (filterCompare.getCompOp() == null) { throw new RuntimeException("The filter parameter has no CompOp instance. " + filterCompare); } QueryAttr attr = filterCompare.getAttr(); Class<?> compOpClass = filterCompare.getCompOp().getClass(); if (valueTypeToCompOpEvaluatorMap.containsKey(attr.getType())) { Map<Class<?>, CompOpEvaluator> map = valueTypeToCompOpEvaluatorMap.get(attr.getType()); if (map.containsKey(compOpClass)) { return map.get(compOpClass); } } Class<?> attrClass = filterCompare.getAttr().getClass(); for (Map.Entry<Class<?>, Map<Class<?>, CompOpEvaluator>> e : attrClassToCompOpEvaluatorMap.entrySet()) { if (e.getKey().isAssignableFrom(attrClass)) { CompOpEvaluator ev = e.getValue().get(compOpClass); if (ev != null) { return ev; } } } CompOpEvaluator ev = defaultAttrCompOpEvaluatorMap.get(compOpClass); if (ev == null) { throw new RuntimeException("Missing compare operator evaluator for operator type: '" + compOpClass + "' evaluator set: " + this); } return ev; }  Object getExprEvaluator(QueryExpr expr); CompOpEvaluator getCompOpEvaluator(QueryExprCompare filterCompare); void addExprEvaluator(Class<? extends QueryExpr> exprClass, QueryExprEvaluator e); void addCompOpEvaluator(Class<? extends CompOp> compOpClass, CompOpEvaluator e); void addCompOpEvaluator(Class<? extends QueryAttr> forAttrClass, Class<? extends CompOp> compOpClass, CompOpEvaluator e); void addCompOpEvaluatorForValueType(Class<?> forValueType, Class<? extends CompOp> compOpClass, CompOpEvaluator e); void addCompOpEvaluator(QueryAttr forAttr, Class<? extends CompOp> compOpClass, CompOpEvaluator e); @SuppressWarnings("unchecked") T lock();  }
@Test(expected=RuntimeException.class) public void shouldThrowExceptionIfCompOpEvaluatorIsMissing() { QueryAttr attr = new QueryAttr("Path", String.class); QueryExprCompare compare = new QueryExprCompare(attr, CompOpEquals.class, null); testee.getCompOpEvaluator(compare); }