Skip to content

Commit 5addb7e

Browse files
author
smgfreeman
committed
fixed Issue 88: OrderingComparison is still describing mismatches backwards
1 parent 613cd12 commit 5addb7e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

hamcrest-library/src/main/java/org/hamcrest/number/OrderingComparison.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ public boolean matchesSafely(T actual) {
2828

2929
@Override
3030
public void describeMismatchSafely(T actual, Description mismatchDescription) {
31-
mismatchDescription.appendValue(expected) .appendText(" was ")
31+
mismatchDescription.appendValue(actual) .appendText(" was ")
3232
.appendText(comparison(actual.compareTo(expected)))
33-
.appendText(" ").appendValue(actual);
33+
.appendText(" ").appendValue(expected);
3434
};
3535

3636
public void describeTo(Description description) {

hamcrest-unit-test/src/main/java/org/hamcrest/number/OrderingComparisonTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ public void testDescription() {
3131
}
3232

3333
public void testMismatchDescriptions() {
34-
assertMismatchDescription("<1> was less than <0>", greaterThan(1), 0);
34+
assertMismatchDescription("<0> was less than <1>", greaterThan(1), 0);
3535
assertMismatchDescription("<1> was equal to <1>", greaterThan(1), 1);
36-
assertMismatchDescription("<0> was greater than <1>", lessThan(0), 1);
36+
assertMismatchDescription("<1> was greater than <0>", lessThan(0), 1);
3737
}
3838

3939
public void testComparesObjectsForGreaterThan() {

0 commit comments

Comments
 (0)