diff -r 000000000000 -r 82d1d1de1a01 carbidecpp20devenv/plugins/org.eclipse.test.source_3.3.0.v20080507/src/org.junit4_4.3.1/junitsrc/org/junit/runner/manipulation/Sorter.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/carbidecpp20devenv/plugins/org.eclipse.test.source_3.3.0.v20080507/src/org.junit4_4.3.1/junitsrc/org/junit/runner/manipulation/Sorter.java Wed Mar 18 17:21:00 2009 -0500 @@ -0,0 +1,41 @@ +package org.junit.runner.manipulation; + +import java.util.Comparator; + +import org.junit.runner.Description; +import org.junit.runner.Runner; + +/** + * A Sorter orders tests. In general you will not need + * to use a Sorter directly. Instead, use {@link org.junit.runner.Request#sortWith(Comparator)}. + * + * + */ +public class Sorter implements Comparator { + private final Comparator fComparator; + + /** + * Creates a Sorter that uses comparator + * to sort tests + * @param comparator the {@link Comparator} to use when sorting tests + */ + public Sorter(Comparator comparator) { + fComparator= comparator; + } + + /** + * Sorts the test in runner using comparator + * @param runner + */ + public void apply(Runner runner) { + if (runner instanceof Sortable) { + Sortable sortable = (Sortable) runner; + sortable.sort(this); + } + } + + /** @inheritDoc */ + public int compare(Description o1, Description o2) { + return fComparator.compare(o1, o2); + } +}