From 85ee2126196c403dab7e05b904a84c05bf58f0db Mon Sep 17 00:00:00 2001 From: Marc Philipp Date: Sun, 11 Oct 2020 13:09:48 +0200 Subject: [PATCH] Simplify assertions --- .../junit/platform/engine/UniqueIdTests.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java b/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java index a8f8a3baed10..bbaf6b15d107 100644 --- a/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java +++ b/platform-tests/src/test/java/org/junit/platform/engine/UniqueIdTests.java @@ -13,6 +13,7 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -174,8 +175,8 @@ void sameEnginesAreEqual() { var id1 = UniqueId.root("engine", "junit-jupiter"); var id2 = UniqueId.root("engine", "junit-jupiter"); - assertTrue(id1.equals(id2)); - assertTrue(id2.equals(id1)); + assertEquals(id2, id1); + assertEquals(id1, id2); assertEquals(id1.hashCode(), id2.hashCode()); } @@ -184,8 +185,8 @@ void differentEnginesAreNotEqual() { var id1 = UniqueId.root("engine", "junit-vintage"); var id2 = UniqueId.root("engine", "junit-jupiter"); - assertFalse(id1.equals(id2)); - assertFalse(id2.equals(id1)); + assertNotEquals(id2, id1); + assertNotEquals(id1, id2); } @Test @@ -193,8 +194,8 @@ void uniqueIdWithSameSegmentsAreEqual() { var id1 = UniqueId.root("engine", "junit-jupiter").append("t1", "v1").append("t2", "v2"); var id2 = UniqueId.root("engine", "junit-jupiter").append("t1", "v1").append("t2", "v2"); - assertTrue(id1.equals(id2)); - assertTrue(id2.equals(id1)); + assertEquals(id2, id1); + assertEquals(id1, id2); assertEquals(id1.hashCode(), id2.hashCode()); } @@ -203,8 +204,8 @@ void differentOrderOfSegmentsAreNotEqual() { var id1 = UniqueId.root("engine", "junit-jupiter").append("t2", "v2").append("t1", "v1"); var id2 = UniqueId.root("engine", "junit-jupiter").append("t1", "v1").append("t2", "v2"); - assertFalse(id1.equals(id2)); - assertFalse(id2.equals(id1)); + assertNotEquals(id2, id1); + assertNotEquals(id1, id2); } @Test @@ -212,8 +213,8 @@ void additionalSegmentMakesItNotEqual() { var id1 = UniqueId.root("engine", "junit-jupiter").append("t1", "v1"); var id2 = id1.append("t2", "v2"); - assertFalse(id1.equals(id2)); - assertFalse(id2.equals(id1)); + assertNotEquals(id2, id1); + assertNotEquals(id1, id2); } }