org.junit.runner.manipulation.Sorter Java Examples

The following examples show how to use org.junit.runner.manipulation.Sorter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuickPerfSpringRunner.java    From quickperf with Apache License 2.0 5 votes vote down vote up
@Override
public void sort(Sorter sorter) {
    if (SystemProperties.TEST_CODE_EXECUTING_IN_NEW_JVM.evaluate()) {
        QUICK_PERF_SPRING_RUNNER_FOR_SPECIFIC_JVM.sort(sorter);
    } else if (quickPerfFeaturesAreDisabled){
      springRunner.sort(sorter);
    } else {
        springRunnerWithQuickPerfFeatures.sort(sorter);
    }
}
 
Example #2
Source File: TestRunner.java    From sis with Apache License 2.0 5 votes vote down vote up
/**
 * Sorts the tests methods using the given sorter. The resulting order may not be totally
 * conform to the sorter specification, since this method will ensure that dependencies
 * are still sorted before dependant tests.
 *
 * @param  sorter  the sorter to use for sorting tests.
 */
@Override
public void sort(final Sorter sorter) {
    final FrameworkMethod[] children = getFilteredChildren();
    for (final FrameworkMethod method : children) {
        sorter.apply(method);
    }
    Arrays.sort(children, (FrameworkMethod o1, FrameworkMethod o2) -> sorter.compare(describeChild(o1), describeChild(o2)));
    sortDependantTestsLast(children);
    filteredChildren = children;
}
 
Example #3
Source File: LoadTimeWeavableTestRunner.java    From rice with Educational Community License v2.0 5 votes vote down vote up
public void sort(Sorter sorter) {
    fSorter = sorter;
    for (FrameworkMethod each : getOriginalFilteredChildren()) {
        sortChild(each);
    }
    Collections.sort(getOriginalFilteredChildren(), comparator());
}
 
Example #4
Source File: PinpointPluginTestSuite.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
private Comparator<? super Runner> comparator(final Sorter sorter) {
    return new Comparator<Runner>() {
        public int compare(Runner o1, Runner o2) {
            return sorter.compare(describeChild(o1), describeChild(o2));
        }
    };
}
 
Example #5
Source File: PinpointPluginTestSuite.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public void sort(Sorter sorter) {
    synchronized (childrenLock) {
        for (Runner each : getFilteredChildren()) {
            sorter.apply(each);
        }
        List<Runner> sortedChildren = new ArrayList<Runner>(getFilteredChildren());
        Collections.sort(sortedChildren, comparator(sorter));
        filteredChildren = Collections.unmodifiableCollection(sortedChildren);
    }
}
 
Example #6
Source File: PinpointPluginTestRunner.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
private Comparator<? super FrameworkMethod> comparator(final Sorter sorter) {
    return new Comparator<FrameworkMethod>() {
        public int compare(FrameworkMethod o1, FrameworkMethod o2) {
            return sorter.compare(describeChild(o1), describeChild(o2));
        }
    };
}
 
Example #7
Source File: PinpointPluginTestRunner.java    From pinpoint with Apache License 2.0 5 votes vote down vote up
public void sort(Sorter sorter) {
    synchronized (childrenLock) {
        for (FrameworkMethod each : getFilteredChildren()) {
            sorter.apply(each);
        }
        List<FrameworkMethod> sortedChildren = new ArrayList<FrameworkMethod>(getFilteredChildren());
        Collections.sort(sortedChildren, comparator(sorter));
        filteredChildren = Collections.unmodifiableCollection(sortedChildren);
    }
}
 
Example #8
Source File: JUnit38ClassRunner.java    From android-test with Apache License 2.0 5 votes vote down vote up
@Override
public void sort(Sorter sorter) {
  if (getTest() instanceof Sortable) {
    Sortable adapter = (Sortable) getTest();
    adapter.sort(sorter);
  }
}
 
Example #9
Source File: SorterUtil.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new instance of {@link SorterUtil}.
 */
private SorterUtil() {
  final String propertySorter = System.getProperty(PROPERTY_SORTER, EMPTY);
  if (SORTER_ALPHANUMERIC.equalsIgnoreCase(propertySorter)) {
    sorter = new Sorter(new Comparator<Description>() {
      public int compare(final Description o1, final Description o2) {
        return o1.getDisplayName().compareTo(o2.getDisplayName());
      }
    });
  } else {
    sorter = Sorter.NULL;
  }
}
 
Example #10
Source File: SorterUtil.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates a new instance of {@link SorterUtil}.
 */
private SorterUtil() {
  final String propertySorter = System.getProperty(PROPERTY_SORTER, EMPTY);
  if (SORTER_ALPHANUMERIC.equalsIgnoreCase(propertySorter)) {
    sorter = new Sorter(new Comparator<Description>() {
      public int compare(final Description o1, final Description o2) {
        return o1.getDisplayName().compareTo(o2.getDisplayName());
      }
    });
  } else {
    sorter = Sorter.NULL;
  }
}
 
Example #11
Source File: QuickPerfSpringRunner.java    From quickperf with Apache License 2.0 5 votes vote down vote up
@Override
public void sort(Sorter sorter) {
    if (SystemProperties.TEST_CODE_EXECUTING_IN_NEW_JVM.evaluate()) {
        QUICK_PERF_SPRING_RUNNER_FOR_SPECIFIC_JVM.sort(sorter);
    } else if (quickPerfFeaturesAreDisabled){
        springRunner.sort(sorter);
    } else {
        springRunnerWithQuickPerfFeatures.sort(sorter);
    }
}
 
Example #12
Source File: QuickPerfSpringRunner.java    From quickperf with Apache License 2.0 5 votes vote down vote up
@Override
public void sort(Sorter sorter) {
    if (SystemProperties.TEST_CODE_EXECUTING_IN_NEW_JVM.evaluate()) {
        QUICK_PERF_SPRING_RUNNER_FOR_SPECIFIC_JVM.sort(sorter);
    } else if (quickPerfFeaturesAreDisabled){
        springRunner.sort(sorter);
    } else {
        springRunnerWithQuickPerfFeatures.sort(sorter);
    }
}
 
Example #13
Source File: ClassRunner.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void sort(final Sorter sorter) {
  super.sort(sorter);
  descriptionOutdated = true;
}
 
Example #14
Source File: SafeRunner.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void sort(final Sorter sorter) {
  if (delegate instanceof Sortable) {
    ((Sortable) delegate).sort(sorter);
  }
}
 
Example #15
Source File: NonExecutingRunner.java    From android-test with Apache License 2.0 4 votes vote down vote up
@Override
public void sort(Sorter sorter) {
  sorter.apply(runner);
}
 
Example #16
Source File: AndroidJUnit4.java    From android-test with Apache License 2.0 4 votes vote down vote up
@Override
public void sort(Sorter sorter) {
  ((Sortable) delegate).sort(sorter);
}
 
Example #17
Source File: AndroidJUnit4.java    From android-test with Apache License 2.0 4 votes vote down vote up
@Override
public void sort(Sorter sorter) {
  ((Sortable) delegate).sort(sorter);
}
 
Example #18
Source File: DiscerningSuite.java    From dsl-devkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void sort(final Sorter sorter) {
  super.sort(sorter);
  descriptionOutdated = true;
}
 
Example #19
Source File: SpringRunnerWithQuickPerfFeatures.java    From quickperf with Apache License 2.0 4 votes vote down vote up
@Override
public void sort(Sorter sorter) {
    super.sort(sorter);
}
 
Example #20
Source File: SpringRunnerWithQuickPerfFeatures.java    From quickperf with Apache License 2.0 4 votes vote down vote up
@Override
public void sort(Sorter sorter) {
    super.sort(sorter);
}
 
Example #21
Source File: SpringRunnerWithQuickPerfFeatures.java    From quickperf with Apache License 2.0 4 votes vote down vote up
@Override
public void sort(Sorter sorter) {
    super.sort(sorter);
}