From 1f1d49bcb1497aba3e62adcc21b018397e0d477c Mon Sep 17 00:00:00 2001 From: Olu <56642018+olu-damilare@users.noreply.github.com> Date: Mon, 31 Oct 2022 22:08:59 +0100 Subject: [PATCH] swapped the order of arguments for assertEquals() (#12956) * Creating a Deep vs Shallow Copy of an Object in Java * completed tests for LinkedHashSet * update * updated PR * swapped the order of arguments for assertEquals() --- .../baeldung/linkedhashset/LinkedHashSetUnitTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core-java-modules/core-java-collections-set-2/src/test/java/com/baeldung/linkedhashset/LinkedHashSetUnitTest.java b/core-java-modules/core-java-collections-set-2/src/test/java/com/baeldung/linkedhashset/LinkedHashSetUnitTest.java index 89b91ba16f..44224c6cf9 100644 --- a/core-java-modules/core-java-collections-set-2/src/test/java/com/baeldung/linkedhashset/LinkedHashSetUnitTest.java +++ b/core-java-modules/core-java-collections-set-2/src/test/java/com/baeldung/linkedhashset/LinkedHashSetUnitTest.java @@ -29,7 +29,7 @@ public class LinkedHashSetUnitTest{ LinkedHashSet linkedHashSet = new LinkedHashSet<>(data); assertFalse(linkedHashSet.isEmpty()); - assertEquals(linkedHashSet.size(), data.size()); + assertEquals(data.size(), linkedHashSet.size()); assertTrue(linkedHashSet.containsAll(data) && data.containsAll(linkedHashSet)); } @@ -64,7 +64,7 @@ public class LinkedHashSetUnitTest{ Collection data = Arrays.asList(1, 1, 2, 3); assertTrue(linkedHashSet.addAll(data)); - assertEquals(linkedHashSet.size(), 3); + assertEquals(3, linkedHashSet.size()); assertTrue(data.containsAll(linkedHashSet) && linkedHashSet.containsAll(data)); } @@ -78,7 +78,7 @@ public class LinkedHashSetUnitTest{ Iterator iterator = linkedHashSet.iterator(); for (int i = 0; i < linkedHashSet.size(); i++) { int nextData = iterator.next(); - assertEquals(nextData, i); + assertEquals(i, nextData); } } @@ -92,8 +92,8 @@ public class LinkedHashSetUnitTest{ Spliterator spliterator = linkedHashSet.spliterator(); AtomicInteger counter = new AtomicInteger(); spliterator.forEachRemaining(data -> { - assertEquals((int)data, counter.get()); - counter.getAndIncrement(); + assertEquals(counter.get(), (int)data); + counter.getAndIncrement(); }); }