From 8fe4f743b3321b3c13da6bd369afa5e427ab1417 Mon Sep 17 00:00:00 2001 From: Joe Schmetzer Date: Sun, 13 Oct 2024 08:49:04 +1100 Subject: [PATCH] Restore original order to IsMapContainingTest --- .../hamcrest/collection/IsMapContainingTest.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java index 6d5cb91d..5c16f9b0 100644 --- a/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java +++ b/hamcrest/src/test/java/org/hamcrest/collection/IsMapContainingTest.java @@ -23,26 +23,26 @@ protected Matcher createMatcher() { } @Test - @SuppressWarnings("unchecked") - public void testMatchesMapContainingMatchingKeyAndValueWithoutGenerics() { - Map map = new HashMap(); + public void testMatchesMapContainingMatchingKeyAndValue() { + Map map = new TreeMap<>(); map.put("a", 1); map.put("b", 2); assertMatches("matcherA", hasEntry(equalTo("a"), equalTo(1)), map); assertMatches("matcherB", hasEntry(equalTo("b"), equalTo(2)), map); - assertFalse(hasEntry(equalTo("c"), equalTo(3)).matches(map), "matcherC"); // working around generics problem + assertMismatchDescription("map was [, ]", hasEntry(equalTo("c"), equalTo(3)), map); } @Test - public void testMatchesMapContainingMatchingKeyAndValue() { - Map map = new TreeMap<>(); + @SuppressWarnings("unchecked") + public void testMatchesMapContainingMatchingKeyAndValueWithoutGenerics() { + Map map = new HashMap(); map.put("a", 1); map.put("b", 2); assertMatches("matcherA", hasEntry(equalTo("a"), equalTo(1)), map); assertMatches("matcherB", hasEntry(equalTo("b"), equalTo(2)), map); - assertMismatchDescription("map was [, ]", hasEntry(equalTo("c"), equalTo(3)), map); + assertFalse(hasEntry(equalTo("c"), equalTo(3)).matches(map), "matcherC"); // working around generics problem } @Test