Criteria implements Serializable { public void addCriterion( String key, Type type, String filterString, Conjunction conjunction) { if (Validator.isNull(filterString)) { return; } Criterion criterion = getCriterion(key); if (criterion == null) { _criteria.put(key, new Criterion(type, filterString, conjunction)); return; } criterion = new Criterion( type, _combineFilters( criterion.getFilterString(), filterString, conjunction), Conjunction.parse(criterion.getConjunction())); _criteria.put(key, criterion); } Criteria(); void addCriterion(
		String key, Type type, String filterString, Conjunction conjunction); void addFilter(
		Type type, String filterString, Conjunction conjunction); Map<String, Criterion> getCriteria(); Criterion getCriterion(String key); String getFilterString(Type type); Map<String, String> getFilterStrings(); Conjunction getTypeConjunction(Type type);  }
@Test public void testAddCriterion() { Criteria criteria = new Criteria(); String key = randomString(); Criteria.Type type = Criteria.Type.CONTEXT; String filterString = randomString(); Criteria.Conjunction conjunction = Criteria.Conjunction.AND; criteria.addCriterion(key, type, filterString, conjunction); Criteria.Criterion criterion = criteria.getCriterion(key); Assert.assertEquals(filterString, criterion.getFilterString()); Assert.assertEquals(type.getValue(), criterion.getTypeValue()); Assert.assertEquals(conjunction.getValue(), criterion.getConjunction()); }