From a8f5dbac2718728d346a2326c879eb62cf667e96 Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Thu, 7 Dec 2023 10:34:47 -0500 Subject: [PATCH] Sort members --- .../commons/lang3/SerializationUtilsTest.java | 20 +++++------ .../lang3/builder/ToStringBuilderTest.java | 36 +++++++++---------- .../commons/lang3/math/NumberUtilsTest.java | 10 +++--- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java index 9c9efaad0..a2d89476c 100644 --- a/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/SerializationUtilsTest.java @@ -241,6 +241,16 @@ public class SerializationUtilsTest extends AbstractLangTest { assertSame(ex, serEx.getCause()); } + @Test + public void testNegativeByteArray() throws IOException { + final byte[] byteArray = { + (byte) -84, (byte) -19, (byte) 0, (byte) 5, (byte) 125, (byte) -19, (byte) 0, + (byte) 5, (byte) 115, (byte) 114, (byte) -1, (byte) 97, (byte) 122, (byte) -48, (byte) -65 + }; + + assertThrows(SerializationException.class, () -> SerializationUtils.deserialize(new ByteArrayInputStream(byteArray))); + } + @Test public void testPrimitiveTypeClassSerialization() { final Class[] primitiveTypes = { byte.class, short.class, int.class, long.class, float.class, double.class, @@ -359,14 +369,4 @@ public class SerializationUtilsTest extends AbstractLangTest { iMap.put(new Object(), new Object()); assertThrows(SerializationException.class, () -> SerializationUtils.serialize(iMap, streamTest)); } - - @Test - public void testNegativeByteArray() throws IOException { - final byte[] byteArray = { - (byte) -84, (byte) -19, (byte) 0, (byte) 5, (byte) 125, (byte) -19, (byte) 0, - (byte) 5, (byte) 115, (byte) 114, (byte) -1, (byte) 97, (byte) 122, (byte) -48, (byte) -65 - }; - - assertThrows(SerializationException.class, () -> SerializationUtils.deserialize(new ByteArrayInputStream(byteArray))); - } } diff --git a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java index 41385cb18..6a53a5814 100644 --- a/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java +++ b/src/test/java/org/apache/commons/lang3/builder/ToStringBuilderTest.java @@ -932,6 +932,15 @@ public class ToStringBuilderTest extends AbstractLangTest { assertReflectionArray("", array); } + @Test + public void testReflectionByteArray() { + byte[] array = { 1, 2, -3, 4 }; + final String baseString = this.toBaseString(array); + assertEquals(baseString + "[{1,2,-3,4}]", ToStringBuilder.reflectionToString(array)); + array = null; + assertReflectionArray("", array); + } + @Test public void testReflectionByteArrayArray() { byte[][] array = { { 1, 2 }, null, { 5 } }; @@ -1047,15 +1056,6 @@ public class ToStringBuilderTest extends AbstractLangTest { } } - @Test - public void testReflectionShort2DArray() { - short[][] array = { { 1, 2 }, null, { 5 } }; - final String baseString = this.toBaseString(array); - assertEquals(baseString + "[{{1,2},,{5}}]", ToStringBuilder.reflectionToString(array)); - array = null; - assertReflectionArray("", array); - } - @Test public void testReflectionIntArray() { int[] array = { 1, 2, -3, 4 }; @@ -1128,6 +1128,15 @@ public class ToStringBuilderTest extends AbstractLangTest { a.toString()); } + @Test + public void testReflectionShort2DArray() { + short[][] array = { { 1, 2 }, null, { 5 } }; + final String baseString = this.toBaseString(array); + assertEquals(baseString + "[{{1,2},,{5}}]", ToStringBuilder.reflectionToString(array)); + array = null; + assertReflectionArray("", array); + } + @Test public void testReflectionShortArray() { short[] array = { 1, 2, -3, 4 }; @@ -1157,15 +1166,6 @@ public class ToStringBuilderTest extends AbstractLangTest { this.toStringWithStatics(instance1, null, ReflectionStaticFieldsFixture.class)); } - @Test - public void testReflectionByteArray() { - byte[] array = { 1, 2, -3, 4 }; - final String baseString = this.toBaseString(array); - assertEquals(baseString + "[{1,2,-3,4}]", ToStringBuilder.reflectionToString(array)); - array = null; - assertReflectionArray("", array); - } - /** * Test a class that defines an ivar pointing to itself. This test was * created to show that handling cyclical object resulted in a missing endFieldSeparator call. diff --git a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java index d2a98ab83..2ce4b9749 100644 --- a/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java +++ b/src/test/java/org/apache/commons/lang3/math/NumberUtilsTest.java @@ -721,6 +721,11 @@ public class NumberUtilsTest extends AbstractLangTest { } } + @Test + public void testInvalidNumber() { + assertThrows(NumberFormatException.class, () -> NumberUtils.createNumber("E123e.3")); + } + /** * Tests isCreatable(String) and tests that createNumber(String) returns a valid number iff isCreatable(String) * returns false. @@ -1743,9 +1748,4 @@ public class NumberUtilsTest extends AbstractLangTest { assertEquals(12345, NumberUtils.toShort("12345", (short) 5), "toShort(String, short) 1 failed"); assertEquals(5, NumberUtils.toShort("1234.5", (short) 5), "toShort(String, short) 2 failed"); } - - @Test - public void testInvalidNumber() { - assertThrows(NumberFormatException.class, () -> NumberUtils.createNumber("E123e.3")); - } }