Matcher matcher = createMatcher();
final List<Comparable[]> sortProjections = new ArrayList<Comparable[]>();
String queryString1 = "from org.infinispan.objectfilter.test.model.Person p where p.age > 18 order by p.name, p.surname";
FilterSubscription filterSubscription = matcher.registerFilter(queryString1, new FilterCallback() {
@Override
public void onFilterResult(Object instance, Object[] projection, Comparable[] sortProjection) {
sortProjections.add(sortProjection);
}
});
matcher.match(createPerson1());
matcher.match(createPerson2());
assertEquals(2, sortProjections.size());
Collections.sort(sortProjections, filterSubscription.getComparator());
assertEquals("Cat", sortProjections.get(0)[0]);
assertEquals("Woman", sortProjections.get(0)[1]);
assertEquals("John", sortProjections.get(1)[0]);
assertEquals("Batman", sortProjections.get(1)[1]);