### Question:
ObjectCombinationSpecificOrdering extends Ordering<ObjectCombination> { @Override public int compare(ObjectCombination left, ObjectCombination right) { if (matchCount(left) < matchCount(right)) { return 1; } else if ( matchCount(left) > matchCount(right)) { return -1; } else if ( !match(activity.getActor(), left.getActor()) && match(activity.getActor(), right.getActor())) { return 1; } else if ( match(activity.getActor(), left.getActor()) && !match(activity.getActor(), right.getActor())) { return -1; } else if ( !match(activity.getObject(), left.getObject()) && match(activity.getObject(), right.getObject())) { return 1; } else if ( match(activity.getObject(), left.getObject()) && !match(activity.getObject(), right.getObject())) { return -1; } else if ( !match(activity.getTarget(), left.getTarget()) && match(activity.getTarget(), right.getTarget())) { return 1; } else if ( match(activity.getTarget(), left.getTarget()) && !match(activity.getTarget(), right.getTarget())) { return -1; } else if ( !match(activity.getProvider(), left.getProvider()) && match(activity.getTarget(), right.getProvider())) { return 1; } else if ( match(activity.getProvider(), left.getProvider()) && !match(activity.getTarget(), right.getProvider())) { return -1; } else { return 0; } } ObjectCombinationSpecificOrdering(Activity activity); @Override int compare(ObjectCombination left, ObjectCombination right); boolean match(ActivityObject activityObject, String pattern);  }### Answer:
@Test public void compareMatchCountTest() { ActivityObject actor = new ActivityObject(); actor.setObjectType("actor"); Activity activity = new Activity().withActor(actor); ObjectCombination combination1 = new ObjectCombination(); ObjectCombination combination2 = new ObjectCombination().withActor("actor"); assert (new ObjectCombinationSpecificOrdering(activity)).compare(combination1, combination2) > 0; Provider provider = new Provider(); provider.setObjectType("application"); Activity activity2 = new Activity().withProvider(provider); ObjectCombination combination3 = new ObjectCombination(); ObjectCombination combination4 = new ObjectCombination().withProvider("application"); assert (new ObjectCombinationSpecificOrdering(activity2)).compare(combination3, combination4) > 0; }