refactoring of CriteriaTest