Class TestResultComparator

java.lang.Object
org.testframe.engine.TestResultComparator
All Implemented Interfaces:
Comparator<TestResult>

public class TestResultComparator extends Object implements Comparator<TestResult>
Compares two test results according to their test result status. The motivation for this comparator is that it enables the test results reporter to group test results according to their test result status, so that, for example, the failing tests are grouped together and one doesn't have to scroll through a long list of results.
Since:
1.0
Author:
Alonso del Arte
  • Constructor Details

    • TestResultComparator

      public TestResultComparator()
  • Method Details

    • compare

      public int compare(TestResult resultA, TestResult resultB)
      Compares test result statuses according to the order in TestResultStatus.
      Specified by:
      compare in interface Comparator<TestResult>
      Parameters:
      resultA - The first status to compare. For example, TestResultStatus.FAILED.
      resultB - The second status to compare. For example, TestResultStatus.PASSED.
      Returns:
      0 if the statuses are the same, a negative integer if resultA's status is listed earlier than resultB's status, or a positive integer if resultA's status is listed later than resultB's status. The range of this function is currently −3 to +3, but this is not guaranteed to stay the same in later versions.