Sort members

This commit is contained in:
Gary Gregory 2023-12-07 10:34:47 -05:00
parent 4b41f2e26f
commit a8f5dbac27
3 changed files with 33 additions and 33 deletions

View File

@ -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)));
}
}

View File

@ -932,6 +932,15 @@ public class ToStringBuilderTest extends AbstractLangTest {
assertReflectionArray("<null>", 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("<null>", 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},<null>,{5}}]", ToStringBuilder.reflectionToString(array));
array = null;
assertReflectionArray("<null>", 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},<null>,{5}}]", ToStringBuilder.reflectionToString(array));
array = null;
assertReflectionArray("<null>", 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("<null>", 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.

View File

@ -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"));
}
}