Simplify boolean tests and avoid boxing
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1387423 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8cb5f67c58
commit
ca1dc33048
|
@ -47,9 +47,9 @@ public class ArrayUtilsTest {
|
|||
assertNotNull(new ArrayUtils());
|
||||
Constructor<?>[] cons = ArrayUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(ArrayUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(ArrayUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(ArrayUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(ArrayUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -88,15 +88,15 @@ public class ArrayUtilsTest {
|
|||
|
||||
//-----------------------------------------------------------------------
|
||||
private void assertIsEquals(Object array1, Object array2, Object array3) {
|
||||
assertEquals(true, ArrayUtils.isEquals(array1, array1));
|
||||
assertEquals(true, ArrayUtils.isEquals(array2, array2));
|
||||
assertEquals(true, ArrayUtils.isEquals(array3, array3));
|
||||
assertEquals(false, ArrayUtils.isEquals(array1, array2));
|
||||
assertEquals(false, ArrayUtils.isEquals(array2, array1));
|
||||
assertEquals(false, ArrayUtils.isEquals(array1, array3));
|
||||
assertEquals(false, ArrayUtils.isEquals(array3, array1));
|
||||
assertEquals(false, ArrayUtils.isEquals(array1, array2));
|
||||
assertEquals(false, ArrayUtils.isEquals(array2, array1));
|
||||
assertTrue(ArrayUtils.isEquals(array1, array1));
|
||||
assertTrue(ArrayUtils.isEquals(array2, array2));
|
||||
assertTrue(ArrayUtils.isEquals(array3, array3));
|
||||
assertFalse(ArrayUtils.isEquals(array1, array2));
|
||||
assertFalse(ArrayUtils.isEquals(array2, array1));
|
||||
assertFalse(ArrayUtils.isEquals(array1, array3));
|
||||
assertFalse(ArrayUtils.isEquals(array3, array1));
|
||||
assertFalse(ArrayUtils.isEquals(array1, array2));
|
||||
assertFalse(ArrayUtils.isEquals(array2, array1));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -143,11 +143,11 @@ public class ArrayUtilsTest {
|
|||
|
||||
Object[] array3 = new Object[]{new String(new char[]{'A', 'B'})};
|
||||
Object[] array4 = new Object[]{"AB"};
|
||||
assertEquals(true, ArrayUtils.isEquals(array3, array3));
|
||||
assertEquals(true, ArrayUtils.isEquals(array3, array4));
|
||||
assertTrue(ArrayUtils.isEquals(array3, array3));
|
||||
assertTrue(ArrayUtils.isEquals(array3, array4));
|
||||
|
||||
assertEquals(true, ArrayUtils.isEquals(null, null));
|
||||
assertEquals(false, ArrayUtils.isEquals(null, array4));
|
||||
assertTrue(ArrayUtils.isEquals(null, null));
|
||||
assertFalse(ArrayUtils.isEquals(null, array4));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -1296,25 +1296,25 @@ public class ArrayUtilsTest {
|
|||
Object[] oneArray = new Object[] {"pick"};
|
||||
Object[] twoArray = new Object[] {"pick", "stick"};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1324,25 +1324,25 @@ public class ArrayUtilsTest {
|
|||
boolean[] oneArray = new boolean[] {true};
|
||||
boolean[] twoArray = new boolean[] {true, false};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1352,25 +1352,25 @@ public class ArrayUtilsTest {
|
|||
long[] oneArray = new long[] {0L};
|
||||
long[] twoArray = new long[] {0L, 76L};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1380,25 +1380,25 @@ public class ArrayUtilsTest {
|
|||
int[] oneArray = new int[] {4};
|
||||
int[] twoArray = new int[] {5, 7};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1408,25 +1408,25 @@ public class ArrayUtilsTest {
|
|||
short[] oneArray = new short[] {4};
|
||||
short[] twoArray = new short[] {6, 8};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1436,25 +1436,25 @@ public class ArrayUtilsTest {
|
|||
char[] oneArray = new char[] {'f'};
|
||||
char[] twoArray = new char[] {'d', 't'};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1464,25 +1464,25 @@ public class ArrayUtilsTest {
|
|||
byte[] oneArray = new byte[] {3};
|
||||
byte[] twoArray = new byte[] {4, 6};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1492,25 +1492,25 @@ public class ArrayUtilsTest {
|
|||
double[] oneArray = new double[] {1.3d};
|
||||
double[] twoArray = new double[] {4.5d, 6.3d};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -1520,25 +1520,25 @@ public class ArrayUtilsTest {
|
|||
float[] oneArray = new float[] {2.5f};
|
||||
float[] twoArray = new float[] {6.4f, 5.8f};
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(nullArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(nullArray, twoArray));
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, nullArray));
|
||||
assertTrue(ArrayUtils.isSameLength(emptyArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(emptyArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, emptyArray));
|
||||
assertTrue(ArrayUtils.isSameLength(oneArray, oneArray));
|
||||
assertFalse(ArrayUtils.isSameLength(oneArray, twoArray));
|
||||
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertEquals(false, ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertEquals(true, ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, nullArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, emptyArray));
|
||||
assertFalse(ArrayUtils.isSameLength(twoArray, oneArray));
|
||||
assertTrue(ArrayUtils.isSameLength(twoArray, twoArray));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -1557,11 +1557,11 @@ public class ArrayUtilsTest {
|
|||
fail();
|
||||
} catch (IllegalArgumentException ex) {}
|
||||
|
||||
assertEquals(true, ArrayUtils.isSameType(new Object[0], new Object[0]));
|
||||
assertEquals(false, ArrayUtils.isSameType(new String[0], new Object[0]));
|
||||
assertEquals(true, ArrayUtils.isSameType(new String[0][0], new String[0][0]));
|
||||
assertEquals(false, ArrayUtils.isSameType(new String[0], new String[0][0]));
|
||||
assertEquals(false, ArrayUtils.isSameType(new String[0][0], new String[0]));
|
||||
assertTrue(ArrayUtils.isSameType(new Object[0], new Object[0]));
|
||||
assertFalse(ArrayUtils.isSameType(new String[0], new Object[0]));
|
||||
assertTrue(ArrayUtils.isSameType(new String[0][0], new String[0][0]));
|
||||
assertFalse(ArrayUtils.isSameType(new String[0], new String[0][0]));
|
||||
assertFalse(ArrayUtils.isSameType(new String[0][0], new String[0]));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -1685,9 +1685,9 @@ public class ArrayUtilsTest {
|
|||
public void testReverseBoolean() {
|
||||
boolean[] array = new boolean[] {false, false, true};
|
||||
ArrayUtils.reverse(array);
|
||||
assertEquals(array[0], true);
|
||||
assertEquals(array[1], false);
|
||||
assertEquals(array[2], false);
|
||||
assertTrue(array[0]);
|
||||
assertFalse(array[1]);
|
||||
assertFalse(array[2]);
|
||||
|
||||
array = null;
|
||||
ArrayUtils.reverse(array);
|
||||
|
@ -1761,14 +1761,14 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContains() {
|
||||
Object[] array = new Object[] { "0", "1", "2", "3", null, "0" };
|
||||
assertEquals(false, ArrayUtils.contains(null, null));
|
||||
assertEquals(false, ArrayUtils.contains(null, "1"));
|
||||
assertEquals(true, ArrayUtils.contains(array, "0"));
|
||||
assertEquals(true, ArrayUtils.contains(array, "1"));
|
||||
assertEquals(true, ArrayUtils.contains(array, "2"));
|
||||
assertEquals(true, ArrayUtils.contains(array, "3"));
|
||||
assertEquals(true, ArrayUtils.contains(array, null));
|
||||
assertEquals(false, ArrayUtils.contains(array, "notInArray"));
|
||||
assertFalse(ArrayUtils.contains(null, null));
|
||||
assertFalse(ArrayUtils.contains(null, "1"));
|
||||
assertTrue(ArrayUtils.contains(array, "0"));
|
||||
assertTrue(ArrayUtils.contains(array, "1"));
|
||||
assertTrue(ArrayUtils.contains(array, "2"));
|
||||
assertTrue(ArrayUtils.contains(array, "3"));
|
||||
assertTrue(ArrayUtils.contains(array, null));
|
||||
assertFalse(ArrayUtils.contains(array, "notInArray"));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -1827,13 +1827,13 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsLong() {
|
||||
long[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, 1));
|
||||
assertFalse(ArrayUtils.contains(array, 1));
|
||||
array = new long[] { 0, 1, 2, 3, 0 };
|
||||
assertEquals(true, ArrayUtils.contains(array, 0));
|
||||
assertEquals(true, ArrayUtils.contains(array, 1));
|
||||
assertEquals(true, ArrayUtils.contains(array, 2));
|
||||
assertEquals(true, ArrayUtils.contains(array, 3));
|
||||
assertEquals(false, ArrayUtils.contains(array, 99));
|
||||
assertTrue(ArrayUtils.contains(array, 0));
|
||||
assertTrue(ArrayUtils.contains(array, 1));
|
||||
assertTrue(ArrayUtils.contains(array, 2));
|
||||
assertTrue(ArrayUtils.contains(array, 3));
|
||||
assertFalse(ArrayUtils.contains(array, 99));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -1892,13 +1892,13 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsInt() {
|
||||
int[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, 1));
|
||||
assertFalse(ArrayUtils.contains(array, 1));
|
||||
array = new int[] { 0, 1, 2, 3, 0 };
|
||||
assertEquals(true, ArrayUtils.contains(array, 0));
|
||||
assertEquals(true, ArrayUtils.contains(array, 1));
|
||||
assertEquals(true, ArrayUtils.contains(array, 2));
|
||||
assertEquals(true, ArrayUtils.contains(array, 3));
|
||||
assertEquals(false, ArrayUtils.contains(array, 99));
|
||||
assertTrue(ArrayUtils.contains(array, 0));
|
||||
assertTrue(ArrayUtils.contains(array, 1));
|
||||
assertTrue(ArrayUtils.contains(array, 2));
|
||||
assertTrue(ArrayUtils.contains(array, 3));
|
||||
assertFalse(ArrayUtils.contains(array, 99));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -1957,13 +1957,13 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsShort() {
|
||||
short[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, (short) 1));
|
||||
assertFalse(ArrayUtils.contains(array, (short) 1));
|
||||
array = new short[] { 0, 1, 2, 3, 0 };
|
||||
assertEquals(true, ArrayUtils.contains(array, (short) 0));
|
||||
assertEquals(true, ArrayUtils.contains(array, (short) 1));
|
||||
assertEquals(true, ArrayUtils.contains(array, (short) 2));
|
||||
assertEquals(true, ArrayUtils.contains(array, (short) 3));
|
||||
assertEquals(false, ArrayUtils.contains(array, (short) 99));
|
||||
assertTrue(ArrayUtils.contains(array, (short) 0));
|
||||
assertTrue(ArrayUtils.contains(array, (short) 1));
|
||||
assertTrue(ArrayUtils.contains(array, (short) 2));
|
||||
assertTrue(ArrayUtils.contains(array, (short) 3));
|
||||
assertFalse(ArrayUtils.contains(array, (short) 99));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -2022,13 +2022,13 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsChar() {
|
||||
char[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, 'b'));
|
||||
assertFalse(ArrayUtils.contains(array, 'b'));
|
||||
array = new char[] { 'a', 'b', 'c', 'd', 'a' };
|
||||
assertEquals(true, ArrayUtils.contains(array, 'a'));
|
||||
assertEquals(true, ArrayUtils.contains(array, 'b'));
|
||||
assertEquals(true, ArrayUtils.contains(array, 'c'));
|
||||
assertEquals(true, ArrayUtils.contains(array, 'd'));
|
||||
assertEquals(false, ArrayUtils.contains(array, 'e'));
|
||||
assertTrue(ArrayUtils.contains(array, 'a'));
|
||||
assertTrue(ArrayUtils.contains(array, 'b'));
|
||||
assertTrue(ArrayUtils.contains(array, 'c'));
|
||||
assertTrue(ArrayUtils.contains(array, 'd'));
|
||||
assertFalse(ArrayUtils.contains(array, 'e'));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -2087,13 +2087,13 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsByte() {
|
||||
byte[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, (byte) 1));
|
||||
assertFalse(ArrayUtils.contains(array, (byte) 1));
|
||||
array = new byte[] { 0, 1, 2, 3, 0 };
|
||||
assertEquals(true, ArrayUtils.contains(array, (byte) 0));
|
||||
assertEquals(true, ArrayUtils.contains(array, (byte) 1));
|
||||
assertEquals(true, ArrayUtils.contains(array, (byte) 2));
|
||||
assertEquals(true, ArrayUtils.contains(array, (byte) 3));
|
||||
assertEquals(false, ArrayUtils.contains(array, (byte) 99));
|
||||
assertTrue(ArrayUtils.contains(array, (byte) 0));
|
||||
assertTrue(ArrayUtils.contains(array, (byte) 1));
|
||||
assertTrue(ArrayUtils.contains(array, (byte) 2));
|
||||
assertTrue(ArrayUtils.contains(array, (byte) 3));
|
||||
assertFalse(ArrayUtils.contains(array, (byte) 99));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -2229,25 +2229,25 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsDouble() {
|
||||
double[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, (double) 1));
|
||||
assertFalse(ArrayUtils.contains(array, (double) 1));
|
||||
array = new double[] { 0, 1, 2, 3, 0 };
|
||||
assertEquals(true, ArrayUtils.contains(array, (double) 0));
|
||||
assertEquals(true, ArrayUtils.contains(array, (double) 1));
|
||||
assertEquals(true, ArrayUtils.contains(array, (double) 2));
|
||||
assertEquals(true, ArrayUtils.contains(array, (double) 3));
|
||||
assertEquals(false, ArrayUtils.contains(array, (double) 99));
|
||||
assertTrue(ArrayUtils.contains(array, (double) 0));
|
||||
assertTrue(ArrayUtils.contains(array, (double) 1));
|
||||
assertTrue(ArrayUtils.contains(array, (double) 2));
|
||||
assertTrue(ArrayUtils.contains(array, (double) 3));
|
||||
assertFalse(ArrayUtils.contains(array, (double) 99));
|
||||
}
|
||||
|
||||
@SuppressWarnings("cast")
|
||||
@Test
|
||||
public void testContainsDoubleTolerance() {
|
||||
double[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, (double) 1, (double) 0));
|
||||
assertFalse(ArrayUtils.contains(array, (double) 1, (double) 0));
|
||||
array = new double[] { 0, 1, 2, 3, 0 };
|
||||
assertEquals(false, ArrayUtils.contains(array, (double) 4.0, (double) 0.33));
|
||||
assertEquals(false, ArrayUtils.contains(array, (double) 2.5, (double) 0.49));
|
||||
assertEquals(true, ArrayUtils.contains(array, (double) 2.5, (double) 0.50));
|
||||
assertEquals(true, ArrayUtils.contains(array, (double) 2.5, (double) 0.51));
|
||||
assertFalse(ArrayUtils.contains(array, (double) 4.0, (double) 0.33));
|
||||
assertFalse(ArrayUtils.contains(array, (double) 2.5, (double) 0.49));
|
||||
assertTrue(ArrayUtils.contains(array, (double) 2.5, (double) 0.50));
|
||||
assertTrue(ArrayUtils.contains(array, (double) 2.5, (double) 0.51));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -2319,13 +2319,13 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsFloat() {
|
||||
float[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, (float) 1));
|
||||
assertFalse(ArrayUtils.contains(array, (float) 1));
|
||||
array = new float[] { 0, 1, 2, 3, 0 };
|
||||
assertEquals(true, ArrayUtils.contains(array, (float) 0));
|
||||
assertEquals(true, ArrayUtils.contains(array, (float) 1));
|
||||
assertEquals(true, ArrayUtils.contains(array, (float) 2));
|
||||
assertEquals(true, ArrayUtils.contains(array, (float) 3));
|
||||
assertEquals(false, ArrayUtils.contains(array, (float) 99));
|
||||
assertTrue(ArrayUtils.contains(array, (float) 0));
|
||||
assertTrue(ArrayUtils.contains(array, (float) 1));
|
||||
assertTrue(ArrayUtils.contains(array, (float) 2));
|
||||
assertTrue(ArrayUtils.contains(array, (float) 3));
|
||||
assertFalse(ArrayUtils.contains(array, (float) 99));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -2390,13 +2390,13 @@ public class ArrayUtilsTest {
|
|||
@Test
|
||||
public void testContainsBoolean() {
|
||||
boolean[] array = null;
|
||||
assertEquals(false, ArrayUtils.contains(array, true));
|
||||
assertFalse(ArrayUtils.contains(array, true));
|
||||
array = new boolean[] { true, false, true };
|
||||
assertEquals(true, ArrayUtils.contains(array, true));
|
||||
assertEquals(true, ArrayUtils.contains(array, false));
|
||||
assertTrue(ArrayUtils.contains(array, true));
|
||||
assertTrue(ArrayUtils.contains(array, false));
|
||||
array = new boolean[] { true, true };
|
||||
assertEquals(true, ArrayUtils.contains(array, true));
|
||||
assertEquals(false, ArrayUtils.contains(array, false));
|
||||
assertTrue(ArrayUtils.contains(array, true));
|
||||
assertFalse(ArrayUtils.contains(array, false));
|
||||
}
|
||||
|
||||
// testToPrimitive/Object for boolean
|
||||
|
@ -2874,9 +2874,9 @@ public class ArrayUtilsTest {
|
|||
public void testIsEmptyObject() {
|
||||
Object[] emptyArray = new Object[] {};
|
||||
Object[] notEmptyArray = new Object[] { new String("Value") };
|
||||
assertEquals(true, ArrayUtils.isEmpty((Object[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyArray));
|
||||
assertTrue(ArrayUtils.isEmpty((Object[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyArray));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2893,51 +2893,51 @@ public class ArrayUtilsTest {
|
|||
public void testIsEmptyPrimitives() {
|
||||
long[] emptyLongArray = new long[] {};
|
||||
long[] notEmptyLongArray = new long[] { 1L };
|
||||
assertEquals(true, ArrayUtils.isEmpty((long[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyLongArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyLongArray));
|
||||
assertTrue(ArrayUtils.isEmpty((long[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyLongArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyLongArray));
|
||||
|
||||
int[] emptyIntArray = new int[] {};
|
||||
int[] notEmptyIntArray = new int[] { 1 };
|
||||
assertEquals(true, ArrayUtils.isEmpty((int[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyIntArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyIntArray));
|
||||
assertTrue(ArrayUtils.isEmpty((int[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyIntArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyIntArray));
|
||||
|
||||
short[] emptyShortArray = new short[] {};
|
||||
short[] notEmptyShortArray = new short[] { 1 };
|
||||
assertEquals(true, ArrayUtils.isEmpty((short[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyShortArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyShortArray));
|
||||
assertTrue(ArrayUtils.isEmpty((short[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyShortArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyShortArray));
|
||||
|
||||
char[] emptyCharArray = new char[] {};
|
||||
char[] notEmptyCharArray = new char[] { 1 };
|
||||
assertEquals(true, ArrayUtils.isEmpty((char[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyCharArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyCharArray));
|
||||
assertTrue(ArrayUtils.isEmpty((char[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyCharArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyCharArray));
|
||||
|
||||
byte[] emptyByteArray = new byte[] {};
|
||||
byte[] notEmptyByteArray = new byte[] { 1 };
|
||||
assertEquals(true, ArrayUtils.isEmpty((byte[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyByteArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyByteArray));
|
||||
assertTrue(ArrayUtils.isEmpty((byte[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyByteArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyByteArray));
|
||||
|
||||
double[] emptyDoubleArray = new double[] {};
|
||||
double[] notEmptyDoubleArray = new double[] { 1.0 };
|
||||
assertEquals(true, ArrayUtils.isEmpty((double[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyDoubleArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyDoubleArray));
|
||||
assertTrue(ArrayUtils.isEmpty((double[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyDoubleArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyDoubleArray));
|
||||
|
||||
float[] emptyFloatArray = new float[] {};
|
||||
float[] notEmptyFloatArray = new float[] { 1.0F };
|
||||
assertEquals(true, ArrayUtils.isEmpty((float[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyFloatArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyFloatArray));
|
||||
assertTrue(ArrayUtils.isEmpty((float[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyFloatArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyFloatArray));
|
||||
|
||||
boolean[] emptyBooleanArray = new boolean[] {};
|
||||
boolean[] notEmptyBooleanArray = new boolean[] { true };
|
||||
assertEquals(true, ArrayUtils.isEmpty((boolean[])null));
|
||||
assertEquals(true, ArrayUtils.isEmpty(emptyBooleanArray));
|
||||
assertEquals(false, ArrayUtils.isEmpty(notEmptyBooleanArray));
|
||||
assertTrue(ArrayUtils.isEmpty((boolean[])null));
|
||||
assertTrue(ArrayUtils.isEmpty(emptyBooleanArray));
|
||||
assertFalse(ArrayUtils.isEmpty(notEmptyBooleanArray));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -188,7 +189,7 @@ public class BitFieldTest {
|
|||
assertEquals(-2, new BitField(1).setByteBoolean((byte) 255, false));
|
||||
byte clearedBit = new BitField(0x40).setByteBoolean((byte) - 63, false);
|
||||
|
||||
assertEquals(false, new BitField(0x40).isSet(clearedBit));
|
||||
assertFalse(new BitField(0x40).isSet(clearedBit));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -41,8 +41,8 @@ public class CharRangeTest {
|
|||
@Test
|
||||
public void testClass() {
|
||||
// class changed to non-public in 3.0
|
||||
assertEquals(false, Modifier.isPublic(CharRange.class.getModifiers()));
|
||||
assertEquals(true, Modifier.isFinal(CharRange.class.getModifiers()));
|
||||
assertFalse(Modifier.isPublic(CharRange.class.getModifiers()));
|
||||
assertTrue(Modifier.isFinal(CharRange.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -51,7 +51,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.is('a');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('a', rangea.getEnd());
|
||||
assertEquals(false, rangea.isNegated());
|
||||
assertFalse(rangea.isNegated());
|
||||
assertEquals("a", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.isNot('a');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('a', rangea.getEnd());
|
||||
assertEquals(true, rangea.isNegated());
|
||||
assertTrue(rangea.isNegated());
|
||||
assertEquals("^a", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.isIn('a', 'a');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('a', rangea.getEnd());
|
||||
assertEquals(false, rangea.isNegated());
|
||||
assertFalse(rangea.isNegated());
|
||||
assertEquals("a", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.isIn('a', 'e');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('e', rangea.getEnd());
|
||||
assertEquals(false, rangea.isNegated());
|
||||
assertFalse(rangea.isNegated());
|
||||
assertEquals("a-e", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.isIn('e', 'a');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('e', rangea.getEnd());
|
||||
assertEquals(false, rangea.isNegated());
|
||||
assertFalse(rangea.isNegated());
|
||||
assertEquals("a-e", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.isNotIn('a', 'a');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('a', rangea.getEnd());
|
||||
assertEquals(true, rangea.isNegated());
|
||||
assertTrue(rangea.isNegated());
|
||||
assertEquals("^a", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.isNotIn('a', 'e');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('e', rangea.getEnd());
|
||||
assertEquals(true, rangea.isNegated());
|
||||
assertTrue(rangea.isNegated());
|
||||
assertEquals("^a-e", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class CharRangeTest {
|
|||
CharRange rangea = CharRange.isNotIn('e', 'a');
|
||||
assertEquals('a', rangea.getStart());
|
||||
assertEquals('e', rangea.getEnd());
|
||||
assertEquals(true, rangea.isNegated());
|
||||
assertTrue(rangea.isNegated());
|
||||
assertEquals("^a-e", rangea.toString());
|
||||
}
|
||||
|
||||
|
@ -125,21 +125,21 @@ public class CharRangeTest {
|
|||
CharRange rangeae = CharRange.isIn('a', 'e');
|
||||
CharRange rangenotbf = CharRange.isIn('b', 'f');
|
||||
|
||||
assertEquals(false, rangea.equals(null));
|
||||
assertFalse(rangea.equals(null));
|
||||
|
||||
assertEquals(true, rangea.equals(rangea));
|
||||
assertEquals(true, rangea.equals(CharRange.is('a')));
|
||||
assertEquals(true, rangeae.equals(rangeae));
|
||||
assertEquals(true, rangeae.equals(CharRange.isIn('a', 'e')));
|
||||
assertEquals(true, rangenotbf.equals(rangenotbf));
|
||||
assertEquals(true, rangenotbf.equals(CharRange.isIn('b', 'f')));
|
||||
assertTrue(rangea.equals(rangea));
|
||||
assertTrue(rangea.equals(CharRange.is('a')));
|
||||
assertTrue(rangeae.equals(rangeae));
|
||||
assertTrue(rangeae.equals(CharRange.isIn('a', 'e')));
|
||||
assertTrue(rangenotbf.equals(rangenotbf));
|
||||
assertTrue(rangenotbf.equals(CharRange.isIn('b', 'f')));
|
||||
|
||||
assertEquals(false, rangea.equals(rangeae));
|
||||
assertEquals(false, rangea.equals(rangenotbf));
|
||||
assertEquals(false, rangeae.equals(rangea));
|
||||
assertEquals(false, rangeae.equals(rangenotbf));
|
||||
assertEquals(false, rangenotbf.equals(rangea));
|
||||
assertEquals(false, rangenotbf.equals(rangeae));
|
||||
assertFalse(rangea.equals(rangeae));
|
||||
assertFalse(rangea.equals(rangenotbf));
|
||||
assertFalse(rangeae.equals(rangea));
|
||||
assertFalse(rangeae.equals(rangenotbf));
|
||||
assertFalse(rangenotbf.equals(rangea));
|
||||
assertFalse(rangenotbf.equals(rangeae));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -155,42 +155,42 @@ public class CharRangeTest {
|
|||
assertEquals(true, rangenotbf.hashCode() == rangenotbf.hashCode());
|
||||
assertEquals(true, rangenotbf.hashCode() == CharRange.isIn('b', 'f').hashCode());
|
||||
|
||||
assertEquals(false, rangea.hashCode() == rangeae.hashCode());
|
||||
assertEquals(false, rangea.hashCode() == rangenotbf.hashCode());
|
||||
assertEquals(false, rangeae.hashCode() == rangea.hashCode());
|
||||
assertEquals(false, rangeae.hashCode() == rangenotbf.hashCode());
|
||||
assertEquals(false, rangenotbf.hashCode() == rangea.hashCode());
|
||||
assertEquals(false, rangenotbf.hashCode() == rangeae.hashCode());
|
||||
assertFalse(rangea.hashCode() == rangeae.hashCode());
|
||||
assertFalse(rangea.hashCode() == rangenotbf.hashCode());
|
||||
assertFalse(rangeae.hashCode() == rangea.hashCode());
|
||||
assertFalse(rangeae.hashCode() == rangenotbf.hashCode());
|
||||
assertFalse(rangenotbf.hashCode() == rangea.hashCode());
|
||||
assertFalse(rangenotbf.hashCode() == rangeae.hashCode());
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@Test
|
||||
public void testContains_Char() {
|
||||
CharRange range = CharRange.is('c');
|
||||
assertEquals(false, range.contains('b'));
|
||||
assertEquals(true, range.contains('c'));
|
||||
assertEquals(false, range.contains('d'));
|
||||
assertEquals(false, range.contains('e'));
|
||||
assertFalse(range.contains('b'));
|
||||
assertTrue(range.contains('c'));
|
||||
assertFalse(range.contains('d'));
|
||||
assertFalse(range.contains('e'));
|
||||
|
||||
range = CharRange.isIn('c', 'd');
|
||||
assertEquals(false, range.contains('b'));
|
||||
assertEquals(true, range.contains('c'));
|
||||
assertEquals(true, range.contains('d'));
|
||||
assertEquals(false, range.contains('e'));
|
||||
assertFalse(range.contains('b'));
|
||||
assertTrue(range.contains('c'));
|
||||
assertTrue(range.contains('d'));
|
||||
assertFalse(range.contains('e'));
|
||||
|
||||
range = CharRange.isIn('d', 'c');
|
||||
assertEquals(false, range.contains('b'));
|
||||
assertEquals(true, range.contains('c'));
|
||||
assertEquals(true, range.contains('d'));
|
||||
assertEquals(false, range.contains('e'));
|
||||
assertFalse(range.contains('b'));
|
||||
assertTrue(range.contains('c'));
|
||||
assertTrue(range.contains('d'));
|
||||
assertFalse(range.contains('e'));
|
||||
|
||||
range = CharRange.isNotIn('c', 'd');
|
||||
assertEquals(true, range.contains('b'));
|
||||
assertEquals(false, range.contains('c'));
|
||||
assertEquals(false, range.contains('d'));
|
||||
assertEquals(true, range.contains('e'));
|
||||
assertEquals(true, range.contains((char) 0));
|
||||
assertEquals(true, range.contains(Character.MAX_VALUE));
|
||||
assertTrue(range.contains('b'));
|
||||
assertFalse(range.contains('c'));
|
||||
assertFalse(range.contains('d'));
|
||||
assertTrue(range.contains('e'));
|
||||
assertTrue(range.contains((char) 0));
|
||||
assertTrue(range.contains(Character.MAX_VALUE));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -211,28 +211,28 @@ public class CharRangeTest {
|
|||
CharRange ae = CharRange.isIn('a', 'e');
|
||||
|
||||
// normal/normal
|
||||
assertEquals(false, c.contains(b));
|
||||
assertEquals(true, c.contains(c));
|
||||
assertEquals(true, c.contains(c2));
|
||||
assertEquals(false, c.contains(d));
|
||||
assertFalse(c.contains(b));
|
||||
assertTrue(c.contains(c));
|
||||
assertTrue(c.contains(c2));
|
||||
assertFalse(c.contains(d));
|
||||
|
||||
assertEquals(false, c.contains(cd));
|
||||
assertEquals(false, c.contains(bd));
|
||||
assertEquals(false, c.contains(bc));
|
||||
assertEquals(false, c.contains(ab));
|
||||
assertEquals(false, c.contains(de));
|
||||
assertFalse(c.contains(cd));
|
||||
assertFalse(c.contains(bd));
|
||||
assertFalse(c.contains(bc));
|
||||
assertFalse(c.contains(ab));
|
||||
assertFalse(c.contains(de));
|
||||
|
||||
assertEquals(true, cd.contains(c));
|
||||
assertEquals(true, bd.contains(c));
|
||||
assertEquals(true, bc.contains(c));
|
||||
assertEquals(false, ab.contains(c));
|
||||
assertEquals(false, de.contains(c));
|
||||
assertTrue(cd.contains(c));
|
||||
assertTrue(bd.contains(c));
|
||||
assertTrue(bc.contains(c));
|
||||
assertFalse(ab.contains(c));
|
||||
assertFalse(de.contains(c));
|
||||
|
||||
assertEquals(true, ae.contains(b));
|
||||
assertEquals(true, ae.contains(ab));
|
||||
assertEquals(true, ae.contains(bc));
|
||||
assertEquals(true, ae.contains(cd));
|
||||
assertEquals(true, ae.contains(de));
|
||||
assertTrue(ae.contains(b));
|
||||
assertTrue(ae.contains(ab));
|
||||
assertTrue(ae.contains(bc));
|
||||
assertTrue(ae.contains(cd));
|
||||
assertTrue(ae.contains(de));
|
||||
|
||||
CharRange notb = CharRange.isNot('b');
|
||||
CharRange notc = CharRange.isNot('c');
|
||||
|
@ -247,66 +247,66 @@ public class CharRangeTest {
|
|||
CharRange allbutfirst = CharRange.isIn((char) 1, Character.MAX_VALUE);
|
||||
|
||||
// normal/negated
|
||||
assertEquals(false, c.contains(notc));
|
||||
assertEquals(false, c.contains(notbd));
|
||||
assertEquals(true, all.contains(notc));
|
||||
assertEquals(true, all.contains(notbd));
|
||||
assertEquals(false, allbutfirst.contains(notc));
|
||||
assertEquals(false, allbutfirst.contains(notbd));
|
||||
assertFalse(c.contains(notc));
|
||||
assertFalse(c.contains(notbd));
|
||||
assertTrue(all.contains(notc));
|
||||
assertTrue(all.contains(notbd));
|
||||
assertFalse(allbutfirst.contains(notc));
|
||||
assertFalse(allbutfirst.contains(notbd));
|
||||
|
||||
// negated/normal
|
||||
assertEquals(true, notc.contains(a));
|
||||
assertEquals(true, notc.contains(b));
|
||||
assertEquals(false, notc.contains(c));
|
||||
assertEquals(true, notc.contains(d));
|
||||
assertEquals(true, notc.contains(e));
|
||||
assertTrue(notc.contains(a));
|
||||
assertTrue(notc.contains(b));
|
||||
assertFalse(notc.contains(c));
|
||||
assertTrue(notc.contains(d));
|
||||
assertTrue(notc.contains(e));
|
||||
|
||||
assertEquals(true, notc.contains(ab));
|
||||
assertEquals(false, notc.contains(bc));
|
||||
assertEquals(false, notc.contains(bd));
|
||||
assertEquals(false, notc.contains(cd));
|
||||
assertEquals(true, notc.contains(de));
|
||||
assertEquals(false, notc.contains(ae));
|
||||
assertEquals(false, notc.contains(all));
|
||||
assertEquals(false, notc.contains(allbutfirst));
|
||||
assertTrue(notc.contains(ab));
|
||||
assertFalse(notc.contains(bc));
|
||||
assertFalse(notc.contains(bd));
|
||||
assertFalse(notc.contains(cd));
|
||||
assertTrue(notc.contains(de));
|
||||
assertFalse(notc.contains(ae));
|
||||
assertFalse(notc.contains(all));
|
||||
assertFalse(notc.contains(allbutfirst));
|
||||
|
||||
assertEquals(true, notbd.contains(a));
|
||||
assertEquals(false, notbd.contains(b));
|
||||
assertEquals(false, notbd.contains(c));
|
||||
assertEquals(false, notbd.contains(d));
|
||||
assertEquals(true, notbd.contains(e));
|
||||
assertTrue(notbd.contains(a));
|
||||
assertFalse(notbd.contains(b));
|
||||
assertFalse(notbd.contains(c));
|
||||
assertFalse(notbd.contains(d));
|
||||
assertTrue(notbd.contains(e));
|
||||
|
||||
assertEquals(true, notcd.contains(ab));
|
||||
assertEquals(false, notcd.contains(bc));
|
||||
assertEquals(false, notcd.contains(bd));
|
||||
assertEquals(false, notcd.contains(cd));
|
||||
assertEquals(false, notcd.contains(de));
|
||||
assertEquals(false, notcd.contains(ae));
|
||||
assertEquals(true, notcd.contains(ef));
|
||||
assertEquals(false, notcd.contains(all));
|
||||
assertEquals(false, notcd.contains(allbutfirst));
|
||||
assertTrue(notcd.contains(ab));
|
||||
assertFalse(notcd.contains(bc));
|
||||
assertFalse(notcd.contains(bd));
|
||||
assertFalse(notcd.contains(cd));
|
||||
assertFalse(notcd.contains(de));
|
||||
assertFalse(notcd.contains(ae));
|
||||
assertTrue(notcd.contains(ef));
|
||||
assertFalse(notcd.contains(all));
|
||||
assertFalse(notcd.contains(allbutfirst));
|
||||
|
||||
// negated/negated
|
||||
assertEquals(false, notc.contains(notb));
|
||||
assertEquals(true, notc.contains(notc));
|
||||
assertEquals(false, notc.contains(notd));
|
||||
assertFalse(notc.contains(notb));
|
||||
assertTrue(notc.contains(notc));
|
||||
assertFalse(notc.contains(notd));
|
||||
|
||||
assertEquals(false, notc.contains(notab));
|
||||
assertEquals(true, notc.contains(notbc));
|
||||
assertEquals(true, notc.contains(notbd));
|
||||
assertEquals(true, notc.contains(notcd));
|
||||
assertEquals(false, notc.contains(notde));
|
||||
assertFalse(notc.contains(notab));
|
||||
assertTrue(notc.contains(notbc));
|
||||
assertTrue(notc.contains(notbd));
|
||||
assertTrue(notc.contains(notcd));
|
||||
assertFalse(notc.contains(notde));
|
||||
|
||||
assertEquals(false, notbd.contains(notb));
|
||||
assertEquals(false, notbd.contains(notc));
|
||||
assertEquals(false, notbd.contains(notd));
|
||||
assertFalse(notbd.contains(notb));
|
||||
assertFalse(notbd.contains(notc));
|
||||
assertFalse(notbd.contains(notd));
|
||||
|
||||
assertEquals(false, notbd.contains(notab));
|
||||
assertEquals(false, notbd.contains(notbc));
|
||||
assertEquals(true, notbd.contains(notbd));
|
||||
assertEquals(false, notbd.contains(notcd));
|
||||
assertEquals(false, notbd.contains(notde));
|
||||
assertEquals(true, notbd.contains(notae));
|
||||
assertFalse(notbd.contains(notab));
|
||||
assertFalse(notbd.contains(notbc));
|
||||
assertTrue(notbd.contains(notbd));
|
||||
assertFalse(notbd.contains(notcd));
|
||||
assertFalse(notbd.contains(notde));
|
||||
assertTrue(notbd.contains(notae));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
@ -39,9 +41,9 @@ public class CharSequenceUtilsTest {
|
|||
assertNotNull(new CharSequenceUtils());
|
||||
Constructor<?>[] cons = CharSequenceUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(CharSequenceUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(CharSequenceUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(CharSequenceUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(CharSequenceUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
|
@ -35,8 +37,8 @@ public class CharSetTest {
|
|||
//-----------------------------------------------------------------------
|
||||
@Test
|
||||
public void testClass() {
|
||||
assertEquals(true, Modifier.isPublic(CharSet.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(CharSet.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(CharSet.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(CharSet.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -109,35 +111,35 @@ public class CharSetTest {
|
|||
set = CharSet.getInstance("abc");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(3, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('c')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
|
||||
|
||||
set = CharSet.getInstance("a-ce-f");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('a', 'c')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', 'c')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
|
||||
set = CharSet.getInstance("ae-f");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
|
||||
set = CharSet.getInstance("e-fa");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
|
||||
set = CharSet.getInstance("ae-fm-pz");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(4, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('m', 'p')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('z')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('e', 'f')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('m', 'p')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('z')));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -148,37 +150,37 @@ public class CharSetTest {
|
|||
set = CharSet.getInstance("^abc");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(3, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('c')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
|
||||
|
||||
set = CharSet.getInstance("b^ac");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(3, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('c')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
|
||||
|
||||
set = CharSet.getInstance("db^ac");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(4, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('d')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('c')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('d')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('c')));
|
||||
|
||||
set = CharSet.getInstance("^b^a");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('b')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('b')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a')));
|
||||
|
||||
set = CharSet.getInstance("b^a-c^z");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(3, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNotIn('a', 'c')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('z')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('b')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('a', 'c')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('z')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('b')));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -189,44 +191,44 @@ public class CharSetTest {
|
|||
set = CharSet.getInstance("-");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
|
||||
|
||||
set = CharSet.getInstance("--");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
|
||||
|
||||
set = CharSet.getInstance("---");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
|
||||
|
||||
set = CharSet.getInstance("----");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
|
||||
|
||||
set = CharSet.getInstance("-a");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
|
||||
|
||||
set = CharSet.getInstance("a-");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-')));
|
||||
|
||||
set = CharSet.getInstance("a--");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('a', '-')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', '-')));
|
||||
|
||||
set = CharSet.getInstance("--a");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('-', 'a')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('-', 'a')));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -236,57 +238,57 @@ public class CharSetTest {
|
|||
set = CharSet.getInstance("^");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('^'))); // "^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('^'))); // "^"
|
||||
|
||||
set = CharSet.getInstance("^^");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
|
||||
|
||||
set = CharSet.getInstance("^^^");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('^'))); // "^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('^'))); // "^"
|
||||
|
||||
set = CharSet.getInstance("^^^^");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^" x2
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^" x2
|
||||
|
||||
set = CharSet.getInstance("a^");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('a'))); // "a"
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('^'))); // "^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('a'))); // "a"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('^'))); // "^"
|
||||
|
||||
set = CharSet.getInstance("^a-");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('a'))); // "^a"
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-'))); // "-"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('a'))); // "^a"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-'))); // "-"
|
||||
|
||||
set = CharSet.getInstance("^^-c");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNotIn('^', 'c'))); // "^^-c"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('^', 'c'))); // "^^-c"
|
||||
|
||||
set = CharSet.getInstance("^c-^");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNotIn('c', '^'))); // "^c-^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('c', '^'))); // "^c-^"
|
||||
|
||||
set = CharSet.getInstance("^c-^d");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNotIn('c', '^'))); // "^c-^"
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('d'))); // "d"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('c', '^'))); // "^c-^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('d'))); // "d"
|
||||
|
||||
set = CharSet.getInstance("^^-");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('-'))); // "-"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNot('^'))); // "^^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('-'))); // "-"
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -296,46 +298,46 @@ public class CharSetTest {
|
|||
|
||||
set = CharSet.getInstance("a-^c");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('a', '^'))); // "a-^"
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('c'))); // "c"
|
||||
assertEquals(false, set.contains('b'));
|
||||
assertEquals(true, set.contains('^'));
|
||||
assertEquals(true, set.contains('_')); // between ^ and a
|
||||
assertEquals(true, set.contains('c'));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', '^'))); // "a-^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('c'))); // "c"
|
||||
assertFalse(set.contains('b'));
|
||||
assertTrue(set.contains('^'));
|
||||
assertTrue(set.contains('_')); // between ^ and a
|
||||
assertTrue(set.contains('c'));
|
||||
|
||||
set = CharSet.getInstance("^a-^c");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNotIn('a', '^'))); // "^a-^"
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.is('c'))); // "c"
|
||||
assertEquals(true, set.contains('b'));
|
||||
assertEquals(false, set.contains('^'));
|
||||
assertEquals(false, set.contains('_')); // between ^ and a
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('a', '^'))); // "^a-^"
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.is('c'))); // "c"
|
||||
assertTrue(set.contains('b'));
|
||||
assertFalse(set.contains('^'));
|
||||
assertFalse(set.contains('_')); // between ^ and a
|
||||
|
||||
set = CharSet.getInstance("a- ^-- "); //contains everything
|
||||
array = set.getCharRanges();
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('a', ' '))); // "a- "
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isNotIn('-', ' '))); // "^-- "
|
||||
assertEquals(true, set.contains('#'));
|
||||
assertEquals(true, set.contains('^'));
|
||||
assertEquals(true, set.contains('a'));
|
||||
assertEquals(true, set.contains('*'));
|
||||
assertEquals(true, set.contains('A'));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', ' '))); // "a- "
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isNotIn('-', ' '))); // "^-- "
|
||||
assertTrue(set.contains('#'));
|
||||
assertTrue(set.contains('^'));
|
||||
assertTrue(set.contains('a'));
|
||||
assertTrue(set.contains('*'));
|
||||
assertTrue(set.contains('A'));
|
||||
|
||||
set = CharSet.getInstance("^-b");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('^','b'))); // "^-b"
|
||||
assertEquals(true, set.contains('b'));
|
||||
assertEquals(true, set.contains('_')); // between ^ and a
|
||||
assertEquals(false, set.contains('A'));
|
||||
assertEquals(true, set.contains('^'));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('^','b'))); // "^-b"
|
||||
assertTrue(set.contains('b'));
|
||||
assertTrue(set.contains('_')); // between ^ and a
|
||||
assertFalse(set.contains('A'));
|
||||
assertTrue(set.contains('^'));
|
||||
|
||||
set = CharSet.getInstance("b-^");
|
||||
array = set.getCharRanges();
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('^','b'))); // "b-^"
|
||||
assertEquals(true, set.contains('b'));
|
||||
assertEquals(true, set.contains('^'));
|
||||
assertEquals(true, set.contains('a')); // between ^ and b
|
||||
assertEquals(false, set.contains('c'));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('^','b'))); // "b-^"
|
||||
assertTrue(set.contains('b'));
|
||||
assertTrue(set.contains('^'));
|
||||
assertTrue(set.contains('a')); // between ^ and b
|
||||
assertFalse(set.contains('c'));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -348,22 +350,22 @@ public class CharSetTest {
|
|||
CharSet notatoc = CharSet.getInstance("^a-c");
|
||||
CharSet notatoc2 = CharSet.getInstance("^a-c");
|
||||
|
||||
assertEquals(false, abc.equals(null));
|
||||
assertFalse(abc.equals(null));
|
||||
|
||||
assertEquals(true, abc.equals(abc));
|
||||
assertEquals(true, abc.equals(abc2));
|
||||
assertEquals(false, abc.equals(atoc));
|
||||
assertEquals(false, abc.equals(notatoc));
|
||||
assertTrue(abc.equals(abc));
|
||||
assertTrue(abc.equals(abc2));
|
||||
assertFalse(abc.equals(atoc));
|
||||
assertFalse(abc.equals(notatoc));
|
||||
|
||||
assertEquals(false, atoc.equals(abc));
|
||||
assertEquals(true, atoc.equals(atoc));
|
||||
assertEquals(true, atoc.equals(atoc2));
|
||||
assertEquals(false, atoc.equals(notatoc));
|
||||
assertFalse(atoc.equals(abc));
|
||||
assertTrue(atoc.equals(atoc));
|
||||
assertTrue(atoc.equals(atoc2));
|
||||
assertFalse(atoc.equals(notatoc));
|
||||
|
||||
assertEquals(false, notatoc.equals(abc));
|
||||
assertEquals(false, notatoc.equals(atoc));
|
||||
assertEquals(true, notatoc.equals(notatoc));
|
||||
assertEquals(true, notatoc.equals(notatoc2));
|
||||
assertFalse(notatoc.equals(abc));
|
||||
assertFalse(notatoc.equals(atoc));
|
||||
assertTrue(notatoc.equals(notatoc));
|
||||
assertTrue(notatoc.equals(notatoc2));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -392,35 +394,35 @@ public class CharSetTest {
|
|||
CharSet bd = CharSet.getInstance("bd");
|
||||
CharSet notbtod = CharSet.getInstance("^b-d");
|
||||
|
||||
assertEquals(false, btod.contains('a'));
|
||||
assertEquals(true, btod.contains('b'));
|
||||
assertEquals(true, btod.contains('c'));
|
||||
assertEquals(true, btod.contains('d'));
|
||||
assertEquals(false, btod.contains('e'));
|
||||
assertFalse(btod.contains('a'));
|
||||
assertTrue(btod.contains('b'));
|
||||
assertTrue(btod.contains('c'));
|
||||
assertTrue(btod.contains('d'));
|
||||
assertFalse(btod.contains('e'));
|
||||
|
||||
assertEquals(false, bcd.contains('a'));
|
||||
assertEquals(true, bcd.contains('b'));
|
||||
assertEquals(true, bcd.contains('c'));
|
||||
assertEquals(true, bcd.contains('d'));
|
||||
assertEquals(false, bcd.contains('e'));
|
||||
assertFalse(bcd.contains('a'));
|
||||
assertTrue(bcd.contains('b'));
|
||||
assertTrue(bcd.contains('c'));
|
||||
assertTrue(bcd.contains('d'));
|
||||
assertFalse(bcd.contains('e'));
|
||||
|
||||
assertEquals(false, bd.contains('a'));
|
||||
assertEquals(true, bd.contains('b'));
|
||||
assertEquals(false, bd.contains('c'));
|
||||
assertEquals(true, bd.contains('d'));
|
||||
assertEquals(false, bd.contains('e'));
|
||||
assertFalse(bd.contains('a'));
|
||||
assertTrue(bd.contains('b'));
|
||||
assertFalse(bd.contains('c'));
|
||||
assertTrue(bd.contains('d'));
|
||||
assertFalse(bd.contains('e'));
|
||||
|
||||
assertEquals(true, notbtod.contains('a'));
|
||||
assertEquals(false, notbtod.contains('b'));
|
||||
assertEquals(false, notbtod.contains('c'));
|
||||
assertEquals(false, notbtod.contains('d'));
|
||||
assertEquals(true, notbtod.contains('e'));
|
||||
assertTrue(notbtod.contains('a'));
|
||||
assertFalse(notbtod.contains('b'));
|
||||
assertFalse(notbtod.contains('c'));
|
||||
assertFalse(notbtod.contains('d'));
|
||||
assertTrue(notbtod.contains('e'));
|
||||
|
||||
assertEquals(false, dtob.contains('a'));
|
||||
assertEquals(true, dtob.contains('b'));
|
||||
assertEquals(true, dtob.contains('c'));
|
||||
assertEquals(true, dtob.contains('d'));
|
||||
assertEquals(false, dtob.contains('e'));
|
||||
assertFalse(dtob.contains('a'));
|
||||
assertTrue(dtob.contains('b'));
|
||||
assertTrue(dtob.contains('c'));
|
||||
assertTrue(dtob.contains('d'));
|
||||
assertFalse(dtob.contains('e'));
|
||||
|
||||
CharRange[] array = dtob.getCharRanges();
|
||||
assertEquals("[b-d]", dtob.toString());
|
||||
|
@ -448,20 +450,20 @@ public class CharSetTest {
|
|||
|
||||
array = CharSet.ASCII_ALPHA.getCharRanges();
|
||||
assertEquals(2, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('a', 'z')));
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('A', 'Z')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', 'z')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('A', 'Z')));
|
||||
|
||||
array = CharSet.ASCII_ALPHA_LOWER.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('a', 'z')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('a', 'z')));
|
||||
|
||||
array = CharSet.ASCII_ALPHA_UPPER.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('A', 'Z')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('A', 'Z')));
|
||||
|
||||
array = CharSet.ASCII_NUMERIC.getCharRanges();
|
||||
assertEquals(1, array.length);
|
||||
assertEquals(true, ArrayUtils.contains(array, CharRange.isIn('0', '9')));
|
||||
assertTrue(ArrayUtils.contains(array, CharRange.isIn('0', '9')));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
@ -37,9 +39,9 @@ public class CharSetUtilsTest {
|
|||
assertNotNull(new CharSetUtils());
|
||||
Constructor<?>[] cons = CharSetUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(CharSetUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(CharSetUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(CharSetUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(CharSetUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -57,9 +57,9 @@ public class ClassUtilsTest {
|
|||
assertNotNull(new ClassUtils());
|
||||
Constructor<?>[] cons = ClassUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(ClassUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(ClassUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(ClassUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(ClassUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
@ -320,13 +320,13 @@ public class ClassUtilsTest {
|
|||
// -------------------------------------------------------------------------
|
||||
@Test
|
||||
public void test_isInnerClass_Class() {
|
||||
assertEquals(true, ClassUtils.isInnerClass(Inner.class));
|
||||
assertEquals(true, ClassUtils.isInnerClass(Map.Entry.class));
|
||||
assertEquals(true, ClassUtils.isInnerClass(new Cloneable() {
|
||||
assertTrue(ClassUtils.isInnerClass(Inner.class));
|
||||
assertTrue(ClassUtils.isInnerClass(Map.Entry.class));
|
||||
assertTrue(ClassUtils.isInnerClass(new Cloneable() {
|
||||
}.getClass()));
|
||||
assertEquals(false, ClassUtils.isInnerClass(this.getClass()));
|
||||
assertEquals(false, ClassUtils.isInnerClass(String.class));
|
||||
assertEquals(false, ClassUtils.isInnerClass(null));
|
||||
assertFalse(ClassUtils.isInnerClass(this.getClass()));
|
||||
assertFalse(ClassUtils.isInnerClass(String.class));
|
||||
assertFalse(ClassUtils.isInnerClass(null));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.apache.commons.lang3;
|
|||
|
||||
import static org.apache.commons.lang3.JavaVersion.JAVA_1_4;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
@ -68,9 +69,9 @@ public class LocaleUtilsTest {
|
|||
assertNotNull(new LocaleUtils());
|
||||
Constructor<?>[] cons = LocaleUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(LocaleUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(LocaleUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(LocaleUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(LocaleUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
|
|
@ -457,7 +457,7 @@ public class ObjectUtilsTest {
|
|||
// bytecode to see if the literals were folded into the
|
||||
// class, or if the bytecode kept the method call.
|
||||
|
||||
assertEquals("CONST(boolean)", true, ObjectUtils.CONST(true));
|
||||
assertTrue("CONST(boolean)", ObjectUtils.CONST(true));
|
||||
assertEquals("CONST(byte)", (byte) 3, ObjectUtils.CONST((byte) 3));
|
||||
assertEquals("CONST(char)", (char) 3, ObjectUtils.CONST((char) 3));
|
||||
assertEquals("CONST(short)", (short) 3, ObjectUtils.CONST((short) 3));
|
||||
|
@ -487,7 +487,7 @@ public class ObjectUtilsTest {
|
|||
double MAGIC_DOUBLE = ObjectUtils.CONST(1.0);
|
||||
String MAGIC_STRING = ObjectUtils.CONST("abc");
|
||||
|
||||
assertEquals(true, MAGIC_FLAG);
|
||||
assertTrue(MAGIC_FLAG);
|
||||
assertEquals(127, MAGIC_BYTE1);
|
||||
assertEquals(127, MAGIC_BYTE2);
|
||||
assertEquals('a', MAGIC_CHAR);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
@ -40,9 +41,9 @@ public class RandomStringUtilsTest {
|
|||
assertNotNull(new RandomStringUtils());
|
||||
Constructor<?>[] cons = RandomStringUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(RandomStringUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(RandomStringUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(RandomStringUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(RandomStringUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
@ -68,7 +69,7 @@ public class RandomStringUtilsTest {
|
|||
r1 = RandomStringUtils.randomAlphabetic(50);
|
||||
assertEquals("randomAlphabetic(50)", 50, r1.length());
|
||||
for(int i = 0; i < r1.length(); i++) {
|
||||
assertEquals("r1 contains alphabetic", true, Character.isLetter(r1.charAt(i)) && !Character.isDigit(r1.charAt(i)));
|
||||
assertTrue("r1 contains alphabetic", Character.isLetter(r1.charAt(i)) && !Character.isDigit(r1.charAt(i)));
|
||||
}
|
||||
r2 = RandomStringUtils.randomAlphabetic(50);
|
||||
assertTrue("!r1.equals(r2)", !r1.equals(r2));
|
||||
|
@ -76,7 +77,7 @@ public class RandomStringUtilsTest {
|
|||
r1 = RandomStringUtils.randomAlphanumeric(50);
|
||||
assertEquals("randomAlphanumeric(50)", 50, r1.length());
|
||||
for(int i = 0; i < r1.length(); i++) {
|
||||
assertEquals("r1 contains alphanumeric", true, Character.isLetterOrDigit(r1.charAt(i)));
|
||||
assertTrue("r1 contains alphanumeric", Character.isLetterOrDigit(r1.charAt(i)));
|
||||
}
|
||||
r2 = RandomStringUtils.randomAlphabetic(50);
|
||||
assertTrue("!r1.equals(r2)", !r1.equals(r2));
|
||||
|
@ -84,7 +85,7 @@ public class RandomStringUtilsTest {
|
|||
r1 = RandomStringUtils.randomNumeric(50);
|
||||
assertEquals("randomNumeric(50)", 50, r1.length());
|
||||
for(int i = 0; i < r1.length(); i++) {
|
||||
assertEquals("r1 contains numeric", true, Character.isDigit(r1.charAt(i)) && !Character.isLetter(r1.charAt(i)));
|
||||
assertTrue("r1 contains numeric", Character.isDigit(r1.charAt(i)) && !Character.isLetter(r1.charAt(i)));
|
||||
}
|
||||
r2 = RandomStringUtils.randomNumeric(50);
|
||||
assertTrue("!r1.equals(r2)", !r1.equals(r2));
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
package org.apache.commons.lang3;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertSame;
|
||||
|
@ -69,9 +70,9 @@ public class SerializationUtilsTest {
|
|||
assertNotNull(new SerializationUtils());
|
||||
Constructor<?>[] cons = SerializationUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(SerializationUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(SerializationUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(SerializationUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(SerializationUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -17,7 +17,9 @@
|
|||
package org.apache.commons.lang3.event;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
|
@ -48,9 +50,9 @@ public class EventUtilsTest
|
|||
assertNotNull(new EventUtils());
|
||||
Constructor<?>[] cons = EventUtils.class.getDeclaredConstructors();
|
||||
assertEquals(1, cons.length);
|
||||
assertEquals(true, Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertEquals(true, Modifier.isPublic(EventUtils.class.getModifiers()));
|
||||
assertEquals(false, Modifier.isFinal(EventUtils.class.getModifiers()));
|
||||
assertTrue(Modifier.isPublic(cons[0].getModifiers()));
|
||||
assertTrue(Modifier.isPublic(EventUtils.class.getModifiers()));
|
||||
assertFalse(Modifier.isFinal(EventUtils.class.getModifiers()));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.junit.Test;
|
|||
*/
|
||||
public class ContextedRuntimeExceptionTest extends AbstractExceptionContextTest<ContextedRuntimeException> {
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
exceptionContext = new ContextedRuntimeException(new Exception(TEST_MESSAGE));
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.junit.Test;
|
|||
*/
|
||||
public class DefaultExceptionContextTest extends AbstractExceptionContextTest<DefaultExceptionContext> {
|
||||
|
||||
@Override
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
exceptionContext = new DefaultExceptionContext();
|
||||
|
|
|
@ -49,13 +49,13 @@ public class MutableBooleanTest {
|
|||
// ----------------------------------------------------------------
|
||||
@Test
|
||||
public void testConstructors() {
|
||||
assertEquals(false, new MutableBoolean().booleanValue());
|
||||
assertFalse(new MutableBoolean().booleanValue());
|
||||
|
||||
assertEquals(true, new MutableBoolean(true).booleanValue());
|
||||
assertEquals(false, new MutableBoolean(false).booleanValue());
|
||||
assertTrue(new MutableBoolean(true).booleanValue());
|
||||
assertFalse(new MutableBoolean(false).booleanValue());
|
||||
|
||||
assertEquals(true, new MutableBoolean(Boolean.TRUE).booleanValue());
|
||||
assertEquals(false, new MutableBoolean(Boolean.FALSE).booleanValue());
|
||||
assertTrue(new MutableBoolean(Boolean.TRUE).booleanValue());
|
||||
assertFalse(new MutableBoolean(Boolean.FALSE).booleanValue());
|
||||
|
||||
try {
|
||||
new MutableBoolean(null);
|
||||
|
@ -70,40 +70,40 @@ public class MutableBooleanTest {
|
|||
final MutableBoolean mutBoolB = new MutableBoolean(false);
|
||||
final MutableBoolean mutBoolC = new MutableBoolean(true);
|
||||
|
||||
assertEquals(true, mutBoolA.equals(mutBoolA));
|
||||
assertEquals(true, mutBoolA.equals(mutBoolB));
|
||||
assertEquals(true, mutBoolB.equals(mutBoolA));
|
||||
assertEquals(true, mutBoolB.equals(mutBoolB));
|
||||
assertEquals(false, mutBoolA.equals(mutBoolC));
|
||||
assertEquals(false, mutBoolB.equals(mutBoolC));
|
||||
assertEquals(true, mutBoolC.equals(mutBoolC));
|
||||
assertEquals(false, mutBoolA.equals(null));
|
||||
assertEquals(false, mutBoolA.equals(Boolean.FALSE));
|
||||
assertEquals(false, mutBoolA.equals("false"));
|
||||
assertTrue(mutBoolA.equals(mutBoolA));
|
||||
assertTrue(mutBoolA.equals(mutBoolB));
|
||||
assertTrue(mutBoolB.equals(mutBoolA));
|
||||
assertTrue(mutBoolB.equals(mutBoolB));
|
||||
assertFalse(mutBoolA.equals(mutBoolC));
|
||||
assertFalse(mutBoolB.equals(mutBoolC));
|
||||
assertTrue(mutBoolC.equals(mutBoolC));
|
||||
assertFalse(mutBoolA.equals(null));
|
||||
assertFalse(mutBoolA.equals(Boolean.FALSE));
|
||||
assertFalse(mutBoolA.equals("false"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetSet() {
|
||||
assertEquals(false, new MutableBoolean().booleanValue());
|
||||
assertFalse(new MutableBoolean().booleanValue());
|
||||
assertEquals(Boolean.FALSE, new MutableBoolean().getValue());
|
||||
|
||||
final MutableBoolean mutBool = new MutableBoolean(false);
|
||||
assertEquals(Boolean.FALSE, mutBool.toBoolean());
|
||||
assertEquals(false, mutBool.booleanValue());
|
||||
assertEquals(true, mutBool.isFalse());
|
||||
assertEquals(false, mutBool.isTrue());
|
||||
assertFalse(mutBool.booleanValue());
|
||||
assertTrue(mutBool.isFalse());
|
||||
assertFalse(mutBool.isTrue());
|
||||
|
||||
mutBool.setValue(Boolean.TRUE);
|
||||
assertEquals(Boolean.TRUE, mutBool.toBoolean());
|
||||
assertEquals(true, mutBool.booleanValue());
|
||||
assertEquals(false, mutBool.isFalse());
|
||||
assertEquals(true, mutBool.isTrue());
|
||||
assertTrue(mutBool.booleanValue());
|
||||
assertFalse(mutBool.isFalse());
|
||||
assertTrue(mutBool.isTrue());
|
||||
|
||||
mutBool.setValue(false);
|
||||
assertEquals(false, mutBool.booleanValue());
|
||||
assertFalse(mutBool.booleanValue());
|
||||
|
||||
mutBool.setValue(true);
|
||||
assertEquals(true, mutBool.booleanValue());
|
||||
assertTrue(mutBool.booleanValue());
|
||||
|
||||
try {
|
||||
mutBool.setValue(null);
|
||||
|
@ -118,11 +118,11 @@ public class MutableBooleanTest {
|
|||
final MutableBoolean mutBoolB = new MutableBoolean(false);
|
||||
final MutableBoolean mutBoolC = new MutableBoolean(true);
|
||||
|
||||
assertEquals(true, mutBoolA.hashCode() == mutBoolA.hashCode());
|
||||
assertEquals(true, mutBoolA.hashCode() == mutBoolB.hashCode());
|
||||
assertEquals(false, mutBoolA.hashCode() == mutBoolC.hashCode());
|
||||
assertEquals(true, mutBoolA.hashCode() == Boolean.FALSE.hashCode());
|
||||
assertEquals(true, mutBoolC.hashCode() == Boolean.TRUE.hashCode());
|
||||
assertEquals(mutBoolA.hashCode(), mutBoolA.hashCode());
|
||||
assertEquals(mutBoolA.hashCode(), mutBoolB.hashCode());
|
||||
assertFalse(mutBoolA.hashCode() == mutBoolC.hashCode());
|
||||
assertEquals(mutBoolA.hashCode(), Boolean.FALSE.hashCode());
|
||||
assertEquals(mutBoolC.hashCode(), Boolean.TRUE.hashCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
Loading…
Reference in New Issue