001 package org.junit.runner.manipulation;
002
003 import java.util.Comparator;
004
005 import org.junit.runner.Description;
006
007 /**
008 * A sorter that orders tests alphanumerically by test name.
009 *
010 * @since 4.13
011 */
012 public final class Alphanumeric extends Sorter implements Ordering.Factory {
013
014 public Alphanumeric() {
015 super(COMPARATOR);
016 }
017
018 public Ordering create(Context context) {
019 return this;
020 }
021
022 private static final Comparator<Description> COMPARATOR = new Comparator<Description>() {
023 public int compare(Description o1, Description o2) {
024 return o1.getDisplayName().compareTo(o2.getDisplayName());
025 }
026 };
027 }