GrabberComparator implements Comparator<T> { public GrabberComparator(GrabberIF<T, G> grabber, Comparator<G> comparator) { this.grabber1 = grabber; this.comparator = comparator; } GrabberComparator(GrabberIF<T, G> grabber, Comparator<G> comparator);  GrabberComparator(GrabberIF<T, G> grabber1, GrabberIF<T, G> grabber2, Comparator<G> comparator); @Override int compare(T object1, T object2);  }
@Test public void testGrabberComparator() { UpperCaseGrabber upg = new UpperCaseGrabber(); LowerCaseGrabber log = new LowerCaseGrabber(); Comparator sc = LexicalComparator.CASE_SENSITIVE; Comparator isc = new GrabberComparator(new UpperCaseGrabber(), sc); testComparator(new GrabberComparator(upg, sc).compare("foobar", "FOOBAR"), 0, 1); testComparator(new GrabberComparator(upg, isc).compare("foobar", "FoOBAR"), 0, 1); testComparator(new GrabberComparator(upg, log, sc).compare("foobar", "FoOBAR"), new GrabberComparator(log, upg, sc).compare("foobar", "FoOBAR") * -1, new GrabberComparator(upg, isc).compare("foobar", "FoOBAR ")); }