From 4754807f4aa6c0befaba6ecfc58d5b159e6b10e1 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 20 Oct 2024 09:07:30 -0400 Subject: [PATCH] Whitespace --- .../comparators/AbstractComparatorTest.java | 26 +++---------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java b/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java index 4759e5d20..3a6df5dfd 100644 --- a/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java +++ b/src/test/java/org/apache/commons/collections4/comparators/AbstractComparatorTest.java @@ -121,34 +121,26 @@ public abstract class AbstractComparatorTest extends AbstractObjectTest { public void testComparatorCompatibility() throws IOException, ClassNotFoundException { if (!skipSerializedCanonicalTests()) { Comparator comparator = null; - // test to make sure the canonical form has been preserved try { comparator = (Comparator) readExternalFormFromDisk(getCanonicalComparatorName(makeObject())); - } catch (final FileNotFoundException exception) { - + } catch (final FileNotFoundException e) { final boolean autoCreateSerialized = false; - if (autoCreateSerialized) { comparator = makeObject(); final String fileName = getCanonicalComparatorName(comparator); writeExternalFormToDisk((Serializable) comparator, fileName); - fail("Serialized form could not be found. A serialized version " - + "has now been written (and should be added to CVS): " + fileName); + fail("Serialized form could not be found. A serialized version " + "has now been written (and should be added to CVS): " + fileName); } else { - fail("The Serialized form could be located to test serialization " - + "compatibility: " + exception.getMessage()); + fail("The Serialized form could be located to test serialization " + "compatibility: " + e.getMessage()); } } - // make sure the canonical form produces the ordering we currently // expect final List randomList = getComparableObjectsOrdered(); reverseObjects(randomList); sortObjects(randomList, comparator); - final List orderedList = getComparableObjectsOrdered(); - assertEquals(orderedList, randomList, "Comparator did not reorder the List correctly"); } } @@ -159,8 +151,7 @@ public abstract class AbstractComparatorTest extends AbstractObjectTest { @Test public void testComparatorIsSerializable() { final Comparator comparator = makeObject(); - assertInstanceOf(Serializable.class, comparator, - "This comparator should be Serializable."); + assertInstanceOf(Serializable.class, comparator, "This comparator should be Serializable."); } /** @@ -170,9 +161,7 @@ public abstract class AbstractComparatorTest extends AbstractObjectTest { public void testEmptyListSort() { final List list = new LinkedList<>(); sortObjects(list, makeObject()); - final List list2 = new LinkedList<>(); - assertEquals(list2, list, "Comparator cannot sort empty lists"); } @@ -182,20 +171,16 @@ public abstract class AbstractComparatorTest extends AbstractObjectTest { @Test public void testRandomListSort() { final Comparator comparator = makeObject(); - final List randomList = getComparableObjectsOrdered(); randomizeObjects(randomList); sortObjects(randomList, comparator); - final List orderedList = getComparableObjectsOrdered(); - /* debug Iterator i = randomList.iterator(); while (i.hasNext()) { System.out.println(i.next()); } */ - assertEquals(orderedList, randomList, "Comparator did not reorder the List correctly"); } @@ -205,13 +190,10 @@ public abstract class AbstractComparatorTest extends AbstractObjectTest { @Test public void testReverseListSort() { final Comparator comparator = makeObject(); - final List randomList = getComparableObjectsOrdered(); reverseObjects(randomList); sortObjects(randomList, comparator); - final List orderedList = getComparableObjectsOrdered(); - assertEquals(orderedList, randomList, "Comparator did not reorder the List correctly"); } }