Clean up assertions (closes #376)
Use built-in assertion methods provides by org.junit.jupiter.api.Assertions instead of reimplementing the same logic with assertTrue and assertFalse. Note that JUnit Jupiter 5.3.1 does not support deltas of 0 for assertEquals(double, double, double) and assertEquals(float, float, float), so these usages of assertTrue were left untouched, and will be addressed when JUnit Jupiter 5.4, that addresses this isssue, will be available (see https://github.com/junit-team/junit5/pull/1613 for details).
This commit is contained in:
parent
b3d86ca08a
commit
3609993fb5
|
@ -24,6 +24,7 @@
|
||||||
import static org.apache.commons.lang3.AnnotationUtilsTest.Stooge.SHEMP;
|
import static org.apache.commons.lang3.AnnotationUtilsTest.Stooge.SHEMP;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
|
import static org.junit.jupiter.api.Assertions.assertTimeoutPreemptively;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -484,16 +485,16 @@ public Object invoke(final Object proxy, final Method method, final Object[] arg
|
||||||
final Test generated = (Test) Proxy.newProxyInstance(Thread.currentThread()
|
final Test generated = (Test) Proxy.newProxyInstance(Thread.currentThread()
|
||||||
.getContextClassLoader(), new Class[]{Test.class},
|
.getContextClassLoader(), new Class[]{Test.class},
|
||||||
generatedTestInvocationHandler);
|
generatedTestInvocationHandler);
|
||||||
assertTrue(real.equals(generated));
|
assertEquals(real, generated);
|
||||||
assertFalse(generated.equals(real));
|
assertNotEquals(generated, real);
|
||||||
assertTrue(AnnotationUtils.equals(generated, real));
|
assertTrue(AnnotationUtils.equals(generated, real));
|
||||||
assertTrue(AnnotationUtils.equals(real, generated));
|
assertTrue(AnnotationUtils.equals(real, generated));
|
||||||
|
|
||||||
final Test generated2 = (Test) Proxy.newProxyInstance(Thread.currentThread()
|
final Test generated2 = (Test) Proxy.newProxyInstance(Thread.currentThread()
|
||||||
.getContextClassLoader(), new Class[]{Test.class},
|
.getContextClassLoader(), new Class[]{Test.class},
|
||||||
generatedTestInvocationHandler);
|
generatedTestInvocationHandler);
|
||||||
assertFalse(generated.equals(generated2));
|
assertNotEquals(generated, generated2);
|
||||||
assertFalse(generated2.equals(generated));
|
assertNotEquals(generated2, generated);
|
||||||
assertTrue(AnnotationUtils.equals(generated, generated2));
|
assertTrue(AnnotationUtils.equals(generated, generated2));
|
||||||
assertTrue(AnnotationUtils.equals(generated2, generated));
|
assertTrue(AnnotationUtils.equals(generated2, generated));
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
package org.apache.commons.lang3;
|
package org.apache.commons.lang3;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public void testInsertBooleans() {
|
||||||
|
|
||||||
final boolean[] result = ArrayUtils.insert(42, array, null);
|
final boolean[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result);
|
assertArrayEquals(array, result);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new boolean[0], ArrayUtils.insert(0, new boolean[0], null));
|
assertArrayEquals(new boolean[0], ArrayUtils.insert(0, new boolean[0], null));
|
||||||
|
@ -61,7 +61,7 @@ public void testInsertBytes() {
|
||||||
|
|
||||||
final byte[] result = ArrayUtils.insert(42, array, null);
|
final byte[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result);
|
assertArrayEquals(array, result);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new byte[0], ArrayUtils.insert(0, new byte[0], null));
|
assertArrayEquals(new byte[0], ArrayUtils.insert(0, new byte[0], null));
|
||||||
|
@ -85,7 +85,7 @@ public void testInsertChars() {
|
||||||
|
|
||||||
final char[] result = ArrayUtils.insert(42, array, null);
|
final char[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result);
|
assertArrayEquals(array, result);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new char[0], ArrayUtils.insert(0, new char[0], null));
|
assertArrayEquals(new char[0], ArrayUtils.insert(0, new char[0], null));
|
||||||
|
@ -110,7 +110,7 @@ public void testInsertDoubles() {
|
||||||
|
|
||||||
final double[] result = ArrayUtils.insert(42, array, null);
|
final double[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result, delta);
|
assertArrayEquals(array, result, delta);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new double[0], ArrayUtils.insert(0, new double[0], null), delta);
|
assertArrayEquals(new double[0], ArrayUtils.insert(0, new double[0], null), delta);
|
||||||
|
@ -135,7 +135,7 @@ public void testInsertFloats() {
|
||||||
|
|
||||||
final float[] result = ArrayUtils.insert(42, array, null);
|
final float[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result, delta);
|
assertArrayEquals(array, result, delta);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new float[0], ArrayUtils.insert(0, new float[0], null), delta);
|
assertArrayEquals(new float[0], ArrayUtils.insert(0, new float[0], null), delta);
|
||||||
|
@ -159,7 +159,7 @@ public void testInsertInts() {
|
||||||
|
|
||||||
final int[] result = ArrayUtils.insert(42, array, null);
|
final int[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result);
|
assertArrayEquals(array, result);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new int[0], ArrayUtils.insert(0, new int[0], null));
|
assertArrayEquals(new int[0], ArrayUtils.insert(0, new int[0], null));
|
||||||
|
@ -184,7 +184,7 @@ public void testInsertLongs() {
|
||||||
|
|
||||||
final long[] result = ArrayUtils.insert(42, array, null);
|
final long[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result);
|
assertArrayEquals(array, result);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new long[0], ArrayUtils.insert(0, new long[0], null));
|
assertArrayEquals(new long[0], ArrayUtils.insert(0, new long[0], null));
|
||||||
|
@ -209,7 +209,7 @@ public void testInsertShorts() {
|
||||||
|
|
||||||
final short[] result = ArrayUtils.insert(42, array, null);
|
final short[] result = ArrayUtils.insert(42, array, null);
|
||||||
assertArrayEquals(array, result);
|
assertArrayEquals(array, result);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new short[0], ArrayUtils.insert(0, new short[0], null));
|
assertArrayEquals(new short[0], ArrayUtils.insert(0, new short[0], null));
|
||||||
|
@ -234,7 +234,7 @@ public void testInsertGenericArray() {
|
||||||
|
|
||||||
final String[] result = ArrayUtils.insert(42, array, (String[]) null);
|
final String[] result = ArrayUtils.insert(42, array, (String[]) null);
|
||||||
assertArrayEquals(array, result);
|
assertArrayEquals(array, result);
|
||||||
assertFalse(array == result);
|
assertNotSame(array, result);
|
||||||
|
|
||||||
assertNull(ArrayUtils.insert(42, null, array));
|
assertNull(ArrayUtils.insert(42, null, array));
|
||||||
assertArrayEquals(new String[0], ArrayUtils.insert(0, new String[0], (String[]) null));
|
assertArrayEquals(new String[0], ArrayUtils.insert(0, new String[0], (String[]) null));
|
||||||
|
|
|
@ -77,17 +77,17 @@ public void testToString() {
|
||||||
public void testHashCode() {
|
public void testHashCode() {
|
||||||
final long[][] array1 = new long[][]{{2, 5}, {4, 5}};
|
final long[][] array1 = new long[][]{{2, 5}, {4, 5}};
|
||||||
final long[][] array2 = new long[][]{{2, 5}, {4, 6}};
|
final long[][] array2 = new long[][]{{2, 5}, {4, 6}};
|
||||||
assertTrue(ArrayUtils.hashCode(array1) == ArrayUtils.hashCode(array1));
|
assertEquals(ArrayUtils.hashCode(array1), ArrayUtils.hashCode(array1));
|
||||||
assertFalse(ArrayUtils.hashCode(array1) == ArrayUtils.hashCode(array2));
|
assertFalse(ArrayUtils.hashCode(array1) == ArrayUtils.hashCode(array2));
|
||||||
|
|
||||||
final Object[] array3 = new Object[]{new String(new char[]{'A', 'B'})};
|
final Object[] array3 = new Object[]{new String(new char[]{'A', 'B'})};
|
||||||
final Object[] array4 = new Object[]{"AB"};
|
final Object[] array4 = new Object[]{"AB"};
|
||||||
assertTrue(ArrayUtils.hashCode(array3) == ArrayUtils.hashCode(array3));
|
assertEquals(ArrayUtils.hashCode(array3), ArrayUtils.hashCode(array3));
|
||||||
assertTrue(ArrayUtils.hashCode(array3) == ArrayUtils.hashCode(array4));
|
assertEquals(ArrayUtils.hashCode(array3), ArrayUtils.hashCode(array4));
|
||||||
|
|
||||||
final Object[] arrayA = new Object[]{new boolean[]{true, false}, new int[]{6, 7}};
|
final Object[] arrayA = new Object[]{new boolean[]{true, false}, new int[]{6, 7}};
|
||||||
final Object[] arrayB = new Object[]{new boolean[]{true, false}, new int[]{6, 7}};
|
final Object[] arrayB = new Object[]{new boolean[]{true, false}, new int[]{6, 7}};
|
||||||
assertTrue(ArrayUtils.hashCode(arrayB) == ArrayUtils.hashCode(arrayA));
|
assertEquals(ArrayUtils.hashCode(arrayB), ArrayUtils.hashCode(arrayA));
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -272,13 +272,13 @@ public void testClone() {
|
||||||
Object[] original1 = new Object[0];
|
Object[] original1 = new Object[0];
|
||||||
Object[] cloned1 = ArrayUtils.clone(original1);
|
Object[] cloned1 = ArrayUtils.clone(original1);
|
||||||
assertTrue(Arrays.equals(original1, cloned1));
|
assertTrue(Arrays.equals(original1, cloned1));
|
||||||
assertTrue(original1 != cloned1);
|
assertNotSame(original1, cloned1);
|
||||||
|
|
||||||
final StringBuilder builder = new StringBuilder("pick");
|
final StringBuilder builder = new StringBuilder("pick");
|
||||||
original1 = new Object[]{builder, "a", new String[]{"stick"}};
|
original1 = new Object[]{builder, "a", new String[]{"stick"}};
|
||||||
cloned1 = ArrayUtils.clone(original1);
|
cloned1 = ArrayUtils.clone(original1);
|
||||||
assertTrue(Arrays.equals(original1, cloned1));
|
assertTrue(Arrays.equals(original1, cloned1));
|
||||||
assertTrue(original1 != cloned1);
|
assertNotSame(original1, cloned1);
|
||||||
assertSame(original1[0], cloned1[0]);
|
assertSame(original1[0], cloned1[0]);
|
||||||
assertSame(original1[1], cloned1[1]);
|
assertSame(original1[1], cloned1[1]);
|
||||||
assertSame(original1[2], cloned1[2]);
|
assertSame(original1[2], cloned1[2]);
|
||||||
|
@ -290,7 +290,7 @@ public void testCloneBoolean() {
|
||||||
final boolean[] original = new boolean[]{true, false};
|
final boolean[] original = new boolean[]{true, false};
|
||||||
final boolean[] cloned = ArrayUtils.clone(original);
|
final boolean[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -299,7 +299,7 @@ public void testCloneLong() {
|
||||||
final long[] original = new long[]{0L, 1L};
|
final long[] original = new long[]{0L, 1L};
|
||||||
final long[] cloned = ArrayUtils.clone(original);
|
final long[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -308,7 +308,7 @@ public void testCloneInt() {
|
||||||
final int[] original = new int[]{5, 8};
|
final int[] original = new int[]{5, 8};
|
||||||
final int[] cloned = ArrayUtils.clone(original);
|
final int[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -317,7 +317,7 @@ public void testCloneShort() {
|
||||||
final short[] original = new short[]{1, 4};
|
final short[] original = new short[]{1, 4};
|
||||||
final short[] cloned = ArrayUtils.clone(original);
|
final short[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -326,7 +326,7 @@ public void testCloneChar() {
|
||||||
final char[] original = new char[]{'a', '4'};
|
final char[] original = new char[]{'a', '4'};
|
||||||
final char[] cloned = ArrayUtils.clone(original);
|
final char[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -335,7 +335,7 @@ public void testCloneByte() {
|
||||||
final byte[] original = new byte[]{1, 6};
|
final byte[] original = new byte[]{1, 6};
|
||||||
final byte[] cloned = ArrayUtils.clone(original);
|
final byte[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -344,7 +344,7 @@ public void testCloneDouble() {
|
||||||
final double[] original = new double[]{2.4d, 5.7d};
|
final double[] original = new double[]{2.4d, 5.7d};
|
||||||
final double[] cloned = ArrayUtils.clone(original);
|
final double[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -353,7 +353,7 @@ public void testCloneFloat() {
|
||||||
final float[] original = new float[]{2.6f, 6.4f};
|
final float[] original = new float[]{2.6f, 6.4f};
|
||||||
final float[] cloned = ArrayUtils.clone(original);
|
final float[] cloned = ArrayUtils.clone(original);
|
||||||
assertTrue(Arrays.equals(original, cloned));
|
assertTrue(Arrays.equals(original, cloned));
|
||||||
assertTrue(original != cloned);
|
assertNotSame(original, cloned);
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
@ -365,8 +365,8 @@ private class TestClass {
|
||||||
public void testNullToEmptyGenericNull() {
|
public void testNullToEmptyGenericNull() {
|
||||||
final TestClass[] output = ArrayUtils.nullToEmpty(null, TestClass[].class);
|
final TestClass[] output = ArrayUtils.nullToEmpty(null, TestClass[].class);
|
||||||
|
|
||||||
assertTrue(output != null);
|
assertNotNull(output);
|
||||||
assertTrue(output.length == 0);
|
assertEquals(0, output.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -1009,8 +1009,8 @@ public void testOr_object_validInput_3items() {
|
||||||
@Test
|
@Test
|
||||||
public void testCompare(){
|
public void testCompare(){
|
||||||
assertTrue(BooleanUtils.compare(true, false) > 0);
|
assertTrue(BooleanUtils.compare(true, false) > 0);
|
||||||
assertTrue(BooleanUtils.compare(true, true) == 0);
|
assertEquals(0, BooleanUtils.compare(true, true));
|
||||||
assertTrue(BooleanUtils.compare(false, false) == 0);
|
assertEquals(0, BooleanUtils.compare(false, false));
|
||||||
assertTrue(BooleanUtils.compare(false, true) < 0);
|
assertTrue(BooleanUtils.compare(false, true) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
@ -123,21 +124,21 @@ public void testEquals_Object() {
|
||||||
final CharRange rangeae = CharRange.isIn('a', 'e');
|
final CharRange rangeae = CharRange.isIn('a', 'e');
|
||||||
final CharRange rangenotbf = CharRange.isIn('b', 'f');
|
final CharRange rangenotbf = CharRange.isIn('b', 'f');
|
||||||
|
|
||||||
assertFalse(rangea.equals(null));
|
assertNotEquals(null, rangea);
|
||||||
|
|
||||||
assertTrue(rangea.equals(rangea));
|
assertEquals(rangea, rangea);
|
||||||
assertTrue(rangea.equals(CharRange.is('a')));
|
assertEquals(rangea, CharRange.is('a'));
|
||||||
assertTrue(rangeae.equals(rangeae));
|
assertEquals(rangeae, rangeae);
|
||||||
assertTrue(rangeae.equals(CharRange.isIn('a', 'e')));
|
assertEquals(rangeae, CharRange.isIn('a', 'e'));
|
||||||
assertTrue(rangenotbf.equals(rangenotbf));
|
assertEquals(rangenotbf, rangenotbf);
|
||||||
assertTrue(rangenotbf.equals(CharRange.isIn('b', 'f')));
|
assertEquals(rangenotbf, CharRange.isIn('b', 'f'));
|
||||||
|
|
||||||
assertFalse(rangea.equals(rangeae));
|
assertNotEquals(rangea, rangeae);
|
||||||
assertFalse(rangea.equals(rangenotbf));
|
assertNotEquals(rangea, rangenotbf);
|
||||||
assertFalse(rangeae.equals(rangea));
|
assertNotEquals(rangeae, rangea);
|
||||||
assertFalse(rangeae.equals(rangenotbf));
|
assertNotEquals(rangeae, rangenotbf);
|
||||||
assertFalse(rangenotbf.equals(rangea));
|
assertNotEquals(rangenotbf, rangea);
|
||||||
assertFalse(rangenotbf.equals(rangeae));
|
assertNotEquals(rangenotbf, rangeae);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -146,12 +147,12 @@ public void testHashCode() {
|
||||||
final CharRange rangeae = CharRange.isIn('a', 'e');
|
final CharRange rangeae = CharRange.isIn('a', 'e');
|
||||||
final CharRange rangenotbf = CharRange.isIn('b', 'f');
|
final CharRange rangenotbf = CharRange.isIn('b', 'f');
|
||||||
|
|
||||||
assertTrue(rangea.hashCode() == rangea.hashCode());
|
assertEquals(rangea.hashCode(), rangea.hashCode());
|
||||||
assertTrue(rangea.hashCode() == CharRange.is('a').hashCode());
|
assertEquals(rangea.hashCode(), CharRange.is('a').hashCode());
|
||||||
assertTrue(rangeae.hashCode() == rangeae.hashCode());
|
assertEquals(rangeae.hashCode(), rangeae.hashCode());
|
||||||
assertTrue(rangeae.hashCode() == CharRange.isIn('a', 'e').hashCode());
|
assertEquals(rangeae.hashCode(), CharRange.isIn('a', 'e').hashCode());
|
||||||
assertTrue(rangenotbf.hashCode() == rangenotbf.hashCode());
|
assertEquals(rangenotbf.hashCode(), rangenotbf.hashCode());
|
||||||
assertTrue(rangenotbf.hashCode() == CharRange.isIn('b', 'f').hashCode());
|
assertEquals(rangenotbf.hashCode(), CharRange.isIn('b', 'f').hashCode());
|
||||||
|
|
||||||
assertFalse(rangea.hashCode() == rangeae.hashCode());
|
assertFalse(rangea.hashCode() == rangeae.hashCode());
|
||||||
assertFalse(rangea.hashCode() == rangenotbf.hashCode());
|
assertFalse(rangea.hashCode() == rangenotbf.hashCode());
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
@ -349,22 +350,22 @@ public void testEquals_Object() {
|
||||||
final CharSet notatoc = CharSet.getInstance("^a-c");
|
final CharSet notatoc = CharSet.getInstance("^a-c");
|
||||||
final CharSet notatoc2 = CharSet.getInstance("^a-c");
|
final CharSet notatoc2 = CharSet.getInstance("^a-c");
|
||||||
|
|
||||||
assertFalse(abc.equals(null));
|
assertNotEquals(null, abc);
|
||||||
|
|
||||||
assertTrue(abc.equals(abc));
|
assertEquals(abc, abc);
|
||||||
assertTrue(abc.equals(abc2));
|
assertEquals(abc, abc2);
|
||||||
assertFalse(abc.equals(atoc));
|
assertNotEquals(abc, atoc);
|
||||||
assertFalse(abc.equals(notatoc));
|
assertNotEquals(abc, notatoc);
|
||||||
|
|
||||||
assertFalse(atoc.equals(abc));
|
assertNotEquals(atoc, abc);
|
||||||
assertTrue(atoc.equals(atoc));
|
assertEquals(atoc, atoc);
|
||||||
assertTrue(atoc.equals(atoc2));
|
assertEquals(atoc, atoc2);
|
||||||
assertFalse(atoc.equals(notatoc));
|
assertNotEquals(atoc, notatoc);
|
||||||
|
|
||||||
assertFalse(notatoc.equals(abc));
|
assertNotEquals(notatoc, abc);
|
||||||
assertFalse(notatoc.equals(atoc));
|
assertNotEquals(notatoc, atoc);
|
||||||
assertTrue(notatoc.equals(notatoc));
|
assertEquals(notatoc, notatoc);
|
||||||
assertTrue(notatoc.equals(notatoc2));
|
assertEquals(notatoc, notatoc2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
@ -41,7 +42,7 @@ public class CharUtilsTest {
|
||||||
@Test
|
@Test
|
||||||
public void testCompare() {
|
public void testCompare() {
|
||||||
assertTrue(CharUtils.compare('a', 'b') < 0);
|
assertTrue(CharUtils.compare('a', 'b') < 0);
|
||||||
assertTrue(CharUtils.compare('c', 'c') == 0);
|
assertEquals(0, CharUtils.compare('c', 'c'));
|
||||||
assertTrue(CharUtils.compare('c', 'a') > 0);
|
assertTrue(CharUtils.compare('c', 'a') > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +242,7 @@ public void testToCharacterObject_char() {
|
||||||
final Character ch = CharUtils.toCharacterObject((char) i);
|
final Character ch = CharUtils.toCharacterObject((char) i);
|
||||||
final Character ch2 = CharUtils.toCharacterObject((char) i);
|
final Character ch2 = CharUtils.toCharacterObject((char) i);
|
||||||
assertEquals(ch, ch2);
|
assertEquals(ch, ch2);
|
||||||
assertTrue(ch != ch2);
|
assertNotSame(ch, ch2);
|
||||||
assertEquals(i, ch.charValue());
|
assertEquals(i, ch.charValue());
|
||||||
assertEquals(i, ch2.charValue());
|
assertEquals(i, ch2.charValue());
|
||||||
}
|
}
|
||||||
|
@ -311,7 +312,7 @@ public void testToString_char() {
|
||||||
final String str = CharUtils.toString((char) i);
|
final String str = CharUtils.toString((char) i);
|
||||||
final String str2 = CharUtils.toString((char) i);
|
final String str2 = CharUtils.toString((char) i);
|
||||||
assertEquals(str, str2);
|
assertEquals(str, str2);
|
||||||
assertTrue(str != str2);
|
assertNotSame(str, str2);
|
||||||
assertEquals(1, str.length());
|
assertEquals(1, str.length());
|
||||||
assertEquals(i, str.charAt(0));
|
assertEquals(i, str.charAt(0));
|
||||||
assertEquals(1, str2.length());
|
assertEquals(1, str2.length());
|
||||||
|
|
|
@ -663,7 +663,7 @@ public void test_getSimpleName_Object_String() {
|
||||||
assertEquals("Inner", ClassUtils.getSimpleName(new Inner(), "<null>"));
|
assertEquals("Inner", ClassUtils.getSimpleName(new Inner(), "<null>"));
|
||||||
assertEquals("String", ClassUtils.getSimpleName("hello", "<null>"));
|
assertEquals("String", ClassUtils.getSimpleName("hello", "<null>"));
|
||||||
assertEquals("<null>", ClassUtils.getSimpleName(null, "<null>"));
|
assertEquals("<null>", ClassUtils.getSimpleName(null, "<null>"));
|
||||||
assertEquals(null, ClassUtils.getSimpleName(null, null));
|
assertNull(ClassUtils.getSimpleName(null, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
@ -147,12 +148,12 @@ public void testEqualsObject() {
|
||||||
assertEquals(byteRange, byteRange);
|
assertEquals(byteRange, byteRange);
|
||||||
assertEquals(byteRange, byteRange2);
|
assertEquals(byteRange, byteRange2);
|
||||||
assertEquals(byteRange2, byteRange2);
|
assertEquals(byteRange2, byteRange2);
|
||||||
assertTrue(byteRange.equals(byteRange));
|
assertEquals(byteRange, byteRange);
|
||||||
assertTrue(byteRange2.equals(byteRange2));
|
assertEquals(byteRange2, byteRange2);
|
||||||
assertTrue(byteRange3.equals(byteRange3));
|
assertEquals(byteRange3, byteRange3);
|
||||||
assertFalse(byteRange2.equals(byteRange3));
|
assertNotEquals(byteRange2, byteRange3);
|
||||||
assertFalse(byteRange2.equals(null));
|
assertNotEquals(null, byteRange2);
|
||||||
assertFalse(byteRange2.equals("Ni!"));
|
assertNotEquals("Ni!", byteRange2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -200,10 +200,10 @@ public void testEqualsAnyIgnoreCase() {
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
@Test
|
@Test
|
||||||
public void testCompare_StringString() {
|
public void testCompare_StringString() {
|
||||||
assertTrue(StringUtils.compare(null, null) == 0);
|
assertEquals(0, StringUtils.compare(null, null));
|
||||||
assertTrue(StringUtils.compare(null, "a") < 0);
|
assertTrue(StringUtils.compare(null, "a") < 0);
|
||||||
assertTrue(StringUtils.compare("a", null) > 0);
|
assertTrue(StringUtils.compare("a", null) > 0);
|
||||||
assertTrue(StringUtils.compare("abc", "abc") == 0);
|
assertEquals(0, StringUtils.compare("abc", "abc"));
|
||||||
assertTrue(StringUtils.compare("a", "b") < 0);
|
assertTrue(StringUtils.compare("a", "b") < 0);
|
||||||
assertTrue(StringUtils.compare("b", "a") > 0);
|
assertTrue(StringUtils.compare("b", "a") > 0);
|
||||||
assertTrue(StringUtils.compare("a", "B") > 0);
|
assertTrue(StringUtils.compare("a", "B") > 0);
|
||||||
|
@ -215,12 +215,12 @@ public void testCompare_StringString() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompare_StringStringBoolean() {
|
public void testCompare_StringStringBoolean() {
|
||||||
assertTrue(StringUtils.compare(null, null, false) == 0);
|
assertEquals(0, StringUtils.compare(null, null, false));
|
||||||
assertTrue(StringUtils.compare(null, "a", true) < 0);
|
assertTrue(StringUtils.compare(null, "a", true) < 0);
|
||||||
assertTrue(StringUtils.compare(null, "a", false) > 0);
|
assertTrue(StringUtils.compare(null, "a", false) > 0);
|
||||||
assertTrue(StringUtils.compare("a", null, true) > 0);
|
assertTrue(StringUtils.compare("a", null, true) > 0);
|
||||||
assertTrue(StringUtils.compare("a", null, false) < 0);
|
assertTrue(StringUtils.compare("a", null, false) < 0);
|
||||||
assertTrue(StringUtils.compare("abc", "abc", false) == 0);
|
assertEquals(0, StringUtils.compare("abc", "abc", false));
|
||||||
assertTrue(StringUtils.compare("a", "b", false) < 0);
|
assertTrue(StringUtils.compare("a", "b", false) < 0);
|
||||||
assertTrue(StringUtils.compare("b", "a", false) > 0);
|
assertTrue(StringUtils.compare("b", "a", false) > 0);
|
||||||
assertTrue(StringUtils.compare("a", "B", false) > 0);
|
assertTrue(StringUtils.compare("a", "B", false) > 0);
|
||||||
|
@ -232,11 +232,11 @@ public void testCompare_StringStringBoolean() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompareIgnoreCase_StringString() {
|
public void testCompareIgnoreCase_StringString() {
|
||||||
assertTrue(StringUtils.compareIgnoreCase(null, null) == 0);
|
assertEquals(0, StringUtils.compareIgnoreCase(null, null));
|
||||||
assertTrue(StringUtils.compareIgnoreCase(null, "a") < 0);
|
assertTrue(StringUtils.compareIgnoreCase(null, "a") < 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("a", null) > 0);
|
assertTrue(StringUtils.compareIgnoreCase("a", null) > 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("abc", "abc") == 0);
|
assertEquals(0, StringUtils.compareIgnoreCase("abc", "abc"));
|
||||||
assertTrue(StringUtils.compareIgnoreCase("abc", "ABC") == 0);
|
assertEquals(0, StringUtils.compareIgnoreCase("abc", "ABC"));
|
||||||
assertTrue(StringUtils.compareIgnoreCase("a", "b") < 0);
|
assertTrue(StringUtils.compareIgnoreCase("a", "b") < 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("b", "a") > 0);
|
assertTrue(StringUtils.compareIgnoreCase("b", "a") > 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("a", "B") < 0);
|
assertTrue(StringUtils.compareIgnoreCase("a", "B") < 0);
|
||||||
|
@ -249,13 +249,13 @@ public void testCompareIgnoreCase_StringString() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompareIgnoreCase_StringStringBoolean() {
|
public void testCompareIgnoreCase_StringStringBoolean() {
|
||||||
assertTrue(StringUtils.compareIgnoreCase(null, null, false) == 0);
|
assertEquals(0, StringUtils.compareIgnoreCase(null, null, false));
|
||||||
assertTrue(StringUtils.compareIgnoreCase(null, "a", true) < 0);
|
assertTrue(StringUtils.compareIgnoreCase(null, "a", true) < 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase(null, "a", false) > 0);
|
assertTrue(StringUtils.compareIgnoreCase(null, "a", false) > 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("a", null, true) > 0);
|
assertTrue(StringUtils.compareIgnoreCase("a", null, true) > 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("a", null, false) < 0);
|
assertTrue(StringUtils.compareIgnoreCase("a", null, false) < 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("abc", "abc", false) == 0);
|
assertEquals(0, StringUtils.compareIgnoreCase("abc", "abc", false));
|
||||||
assertTrue(StringUtils.compareIgnoreCase("abc", "ABC", false) == 0);
|
assertEquals(0, StringUtils.compareIgnoreCase("abc", "ABC", false));
|
||||||
assertTrue(StringUtils.compareIgnoreCase("a", "b", false) < 0);
|
assertTrue(StringUtils.compareIgnoreCase("a", "b", false) < 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("b", "a", false) > 0);
|
assertTrue(StringUtils.compareIgnoreCase("b", "a", false) > 0);
|
||||||
assertTrue(StringUtils.compareIgnoreCase("a", "B", false) < 0);
|
assertTrue(StringUtils.compareIgnoreCase("a", "B", false) < 0);
|
||||||
|
|
|
@ -1653,9 +1653,9 @@ public void testChomp() {
|
||||||
assertEquals("", StringUtils.chomp("", "foo"), "chomp(String, String) failed");
|
assertEquals("", StringUtils.chomp("", "foo"), "chomp(String, String) failed");
|
||||||
assertEquals("", StringUtils.chomp("", null), "chomp(String, String) failed");
|
assertEquals("", StringUtils.chomp("", null), "chomp(String, String) failed");
|
||||||
assertEquals("", StringUtils.chomp("", ""), "chomp(String, String) failed");
|
assertEquals("", StringUtils.chomp("", ""), "chomp(String, String) failed");
|
||||||
assertEquals(null, StringUtils.chomp(null, "foo"), "chomp(String, String) failed");
|
assertNull(StringUtils.chomp(null, "foo"), "chomp(String, String) failed");
|
||||||
assertEquals(null, StringUtils.chomp(null, null), "chomp(String, String) failed");
|
assertNull(StringUtils.chomp(null, null), "chomp(String, String) failed");
|
||||||
assertEquals(null, StringUtils.chomp(null, ""), "chomp(String, String) failed");
|
assertNull(StringUtils.chomp(null, ""), "chomp(String, String) failed");
|
||||||
assertEquals("", StringUtils.chomp("foo", "foo"), "chomp(String, String) failed");
|
assertEquals("", StringUtils.chomp("foo", "foo"), "chomp(String, String) failed");
|
||||||
assertEquals(" ", StringUtils.chomp(" foo", "foo"), "chomp(String, String) failed");
|
assertEquals(" ", StringUtils.chomp(" foo", "foo"), "chomp(String, String) failed");
|
||||||
assertEquals("foo ", StringUtils.chomp("foo ", "foo"), "chomp(String, String) failed");
|
assertEquals("foo ", StringUtils.chomp("foo ", "foo"), "chomp(String, String) failed");
|
||||||
|
@ -2920,14 +2920,14 @@ public void testUnescapeSurrogatePairs() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAppendIfMissing() {
|
public void testAppendIfMissing() {
|
||||||
assertEquals(null, StringUtils.appendIfMissing(null, null), "appendIfMissing(null,null)");
|
assertNull(StringUtils.appendIfMissing(null, null), "appendIfMissing(null,null)");
|
||||||
assertEquals("abc", StringUtils.appendIfMissing("abc", null), "appendIfMissing(abc,null)");
|
assertEquals("abc", StringUtils.appendIfMissing("abc", null), "appendIfMissing(abc,null)");
|
||||||
assertEquals("xyz", StringUtils.appendIfMissing("", "xyz"), "appendIfMissing(\"\",xyz)");
|
assertEquals("xyz", StringUtils.appendIfMissing("", "xyz"), "appendIfMissing(\"\",xyz)");
|
||||||
assertEquals("abcxyz", StringUtils.appendIfMissing("abc", "xyz"), "appendIfMissing(abc,xyz)");
|
assertEquals("abcxyz", StringUtils.appendIfMissing("abc", "xyz"), "appendIfMissing(abc,xyz)");
|
||||||
assertEquals("abcxyz", StringUtils.appendIfMissing("abcxyz", "xyz"), "appendIfMissing(abcxyz,xyz)");
|
assertEquals("abcxyz", StringUtils.appendIfMissing("abcxyz", "xyz"), "appendIfMissing(abcxyz,xyz)");
|
||||||
assertEquals("aXYZxyz", StringUtils.appendIfMissing("aXYZ", "xyz"), "appendIfMissing(aXYZ,xyz)");
|
assertEquals("aXYZxyz", StringUtils.appendIfMissing("aXYZ", "xyz"), "appendIfMissing(aXYZ,xyz)");
|
||||||
|
|
||||||
assertEquals(null, StringUtils.appendIfMissing(null, null, (CharSequence[]) null), "appendIfMissing(null,null,null)");
|
assertNull(StringUtils.appendIfMissing(null, null, (CharSequence[]) null), "appendIfMissing(null,null,null)");
|
||||||
assertEquals("abc", StringUtils.appendIfMissing("abc", null, (CharSequence[]) null), "appendIfMissing(abc,null,null)");
|
assertEquals("abc", StringUtils.appendIfMissing("abc", null, (CharSequence[]) null), "appendIfMissing(abc,null,null)");
|
||||||
assertEquals("xyz", StringUtils.appendIfMissing("", "xyz", (CharSequence[]) null), "appendIfMissing(\"\",xyz,null))");
|
assertEquals("xyz", StringUtils.appendIfMissing("", "xyz", (CharSequence[]) null), "appendIfMissing(\"\",xyz,null))");
|
||||||
assertEquals("abcxyz", StringUtils.appendIfMissing("abc", "xyz", new CharSequence[]{null}), "appendIfMissing(abc,xyz,{null})");
|
assertEquals("abcxyz", StringUtils.appendIfMissing("abc", "xyz", new CharSequence[]{null}), "appendIfMissing(abc,xyz,{null})");
|
||||||
|
@ -2944,14 +2944,14 @@ public void testAppendIfMissing() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testAppendIfMissingIgnoreCase() {
|
public void testAppendIfMissingIgnoreCase() {
|
||||||
assertEquals(null, StringUtils.appendIfMissingIgnoreCase(null, null), "appendIfMissingIgnoreCase(null,null)");
|
assertNull(StringUtils.appendIfMissingIgnoreCase(null, null), "appendIfMissingIgnoreCase(null,null)");
|
||||||
assertEquals("abc", StringUtils.appendIfMissingIgnoreCase("abc", null), "appendIfMissingIgnoreCase(abc,null)");
|
assertEquals("abc", StringUtils.appendIfMissingIgnoreCase("abc", null), "appendIfMissingIgnoreCase(abc,null)");
|
||||||
assertEquals("xyz", StringUtils.appendIfMissingIgnoreCase("", "xyz"), "appendIfMissingIgnoreCase(\"\",xyz)");
|
assertEquals("xyz", StringUtils.appendIfMissingIgnoreCase("", "xyz"), "appendIfMissingIgnoreCase(\"\",xyz)");
|
||||||
assertEquals("abcxyz", StringUtils.appendIfMissingIgnoreCase("abc", "xyz"), "appendIfMissingIgnoreCase(abc,xyz)");
|
assertEquals("abcxyz", StringUtils.appendIfMissingIgnoreCase("abc", "xyz"), "appendIfMissingIgnoreCase(abc,xyz)");
|
||||||
assertEquals("abcxyz", StringUtils.appendIfMissingIgnoreCase("abcxyz", "xyz"), "appendIfMissingIgnoreCase(abcxyz,xyz)");
|
assertEquals("abcxyz", StringUtils.appendIfMissingIgnoreCase("abcxyz", "xyz"), "appendIfMissingIgnoreCase(abcxyz,xyz)");
|
||||||
assertEquals("abcXYZ", StringUtils.appendIfMissingIgnoreCase("abcXYZ", "xyz"), "appendIfMissingIgnoreCase(abcXYZ,xyz)");
|
assertEquals("abcXYZ", StringUtils.appendIfMissingIgnoreCase("abcXYZ", "xyz"), "appendIfMissingIgnoreCase(abcXYZ,xyz)");
|
||||||
|
|
||||||
assertEquals(null, StringUtils.appendIfMissingIgnoreCase(null, null, (CharSequence[]) null), "appendIfMissingIgnoreCase(null,null,null)");
|
assertNull(StringUtils.appendIfMissingIgnoreCase(null, null, (CharSequence[]) null), "appendIfMissingIgnoreCase(null,null,null)");
|
||||||
assertEquals("abc", StringUtils.appendIfMissingIgnoreCase("abc", null, (CharSequence[]) null), "appendIfMissingIgnoreCase(abc,null,null)");
|
assertEquals("abc", StringUtils.appendIfMissingIgnoreCase("abc", null, (CharSequence[]) null), "appendIfMissingIgnoreCase(abc,null,null)");
|
||||||
assertEquals("xyz", StringUtils.appendIfMissingIgnoreCase("", "xyz", (CharSequence[]) null), "appendIfMissingIgnoreCase(\"\",xyz,null)");
|
assertEquals("xyz", StringUtils.appendIfMissingIgnoreCase("", "xyz", (CharSequence[]) null), "appendIfMissingIgnoreCase(\"\",xyz,null)");
|
||||||
assertEquals("abcxyz", StringUtils.appendIfMissingIgnoreCase("abc", "xyz", new CharSequence[]{null}), "appendIfMissingIgnoreCase(abc,xyz,{null})");
|
assertEquals("abcxyz", StringUtils.appendIfMissingIgnoreCase("abc", "xyz", new CharSequence[]{null}), "appendIfMissingIgnoreCase(abc,xyz,{null})");
|
||||||
|
@ -2968,14 +2968,14 @@ public void testAppendIfMissingIgnoreCase() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPrependIfMissing() {
|
public void testPrependIfMissing() {
|
||||||
assertEquals(null, StringUtils.prependIfMissing(null, null), "prependIfMissing(null,null)");
|
assertNull(StringUtils.prependIfMissing(null, null), "prependIfMissing(null,null)");
|
||||||
assertEquals("abc", StringUtils.prependIfMissing("abc", null), "prependIfMissing(abc,null)");
|
assertEquals("abc", StringUtils.prependIfMissing("abc", null), "prependIfMissing(abc,null)");
|
||||||
assertEquals("xyz", StringUtils.prependIfMissing("", "xyz"), "prependIfMissing(\"\",xyz)");
|
assertEquals("xyz", StringUtils.prependIfMissing("", "xyz"), "prependIfMissing(\"\",xyz)");
|
||||||
assertEquals("xyzabc", StringUtils.prependIfMissing("abc", "xyz"), "prependIfMissing(abc,xyz)");
|
assertEquals("xyzabc", StringUtils.prependIfMissing("abc", "xyz"), "prependIfMissing(abc,xyz)");
|
||||||
assertEquals("xyzabc", StringUtils.prependIfMissing("xyzabc", "xyz"), "prependIfMissing(xyzabc,xyz)");
|
assertEquals("xyzabc", StringUtils.prependIfMissing("xyzabc", "xyz"), "prependIfMissing(xyzabc,xyz)");
|
||||||
assertEquals("xyzXYZabc", StringUtils.prependIfMissing("XYZabc", "xyz"), "prependIfMissing(XYZabc,xyz)");
|
assertEquals("xyzXYZabc", StringUtils.prependIfMissing("XYZabc", "xyz"), "prependIfMissing(XYZabc,xyz)");
|
||||||
|
|
||||||
assertEquals(null, StringUtils.prependIfMissing(null, null, (CharSequence[]) null), "prependIfMissing(null,null null)");
|
assertNull(StringUtils.prependIfMissing(null, null, (CharSequence[]) null), "prependIfMissing(null,null null)");
|
||||||
assertEquals("abc", StringUtils.prependIfMissing("abc", null, (CharSequence[]) null), "prependIfMissing(abc,null,null)");
|
assertEquals("abc", StringUtils.prependIfMissing("abc", null, (CharSequence[]) null), "prependIfMissing(abc,null,null)");
|
||||||
assertEquals("xyz", StringUtils.prependIfMissing("", "xyz", (CharSequence[]) null), "prependIfMissing(\"\",xyz,null)");
|
assertEquals("xyz", StringUtils.prependIfMissing("", "xyz", (CharSequence[]) null), "prependIfMissing(\"\",xyz,null)");
|
||||||
assertEquals("xyzabc", StringUtils.prependIfMissing("abc", "xyz", new CharSequence[]{null}), "prependIfMissing(abc,xyz,{null})");
|
assertEquals("xyzabc", StringUtils.prependIfMissing("abc", "xyz", new CharSequence[]{null}), "prependIfMissing(abc,xyz,{null})");
|
||||||
|
@ -2992,14 +2992,14 @@ public void testPrependIfMissing() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testPrependIfMissingIgnoreCase() {
|
public void testPrependIfMissingIgnoreCase() {
|
||||||
assertEquals(null, StringUtils.prependIfMissingIgnoreCase(null, null), "prependIfMissingIgnoreCase(null,null)");
|
assertNull(StringUtils.prependIfMissingIgnoreCase(null, null), "prependIfMissingIgnoreCase(null,null)");
|
||||||
assertEquals("abc", StringUtils.prependIfMissingIgnoreCase("abc", null), "prependIfMissingIgnoreCase(abc,null)");
|
assertEquals("abc", StringUtils.prependIfMissingIgnoreCase("abc", null), "prependIfMissingIgnoreCase(abc,null)");
|
||||||
assertEquals("xyz", StringUtils.prependIfMissingIgnoreCase("", "xyz"), "prependIfMissingIgnoreCase(\"\",xyz)");
|
assertEquals("xyz", StringUtils.prependIfMissingIgnoreCase("", "xyz"), "prependIfMissingIgnoreCase(\"\",xyz)");
|
||||||
assertEquals("xyzabc", StringUtils.prependIfMissingIgnoreCase("abc", "xyz"), "prependIfMissingIgnoreCase(abc,xyz)");
|
assertEquals("xyzabc", StringUtils.prependIfMissingIgnoreCase("abc", "xyz"), "prependIfMissingIgnoreCase(abc,xyz)");
|
||||||
assertEquals("xyzabc", StringUtils.prependIfMissingIgnoreCase("xyzabc", "xyz"), "prependIfMissingIgnoreCase(xyzabc,xyz)");
|
assertEquals("xyzabc", StringUtils.prependIfMissingIgnoreCase("xyzabc", "xyz"), "prependIfMissingIgnoreCase(xyzabc,xyz)");
|
||||||
assertEquals("XYZabc", StringUtils.prependIfMissingIgnoreCase("XYZabc", "xyz"), "prependIfMissingIgnoreCase(XYZabc,xyz)");
|
assertEquals("XYZabc", StringUtils.prependIfMissingIgnoreCase("XYZabc", "xyz"), "prependIfMissingIgnoreCase(XYZabc,xyz)");
|
||||||
|
|
||||||
assertEquals(null, StringUtils.prependIfMissingIgnoreCase(null, null, (CharSequence[]) null), "prependIfMissingIgnoreCase(null,null null)");
|
assertNull(StringUtils.prependIfMissingIgnoreCase(null, null, (CharSequence[]) null), "prependIfMissingIgnoreCase(null,null null)");
|
||||||
assertEquals("abc", StringUtils.prependIfMissingIgnoreCase("abc", null, (CharSequence[]) null), "prependIfMissingIgnoreCase(abc,null,null)");
|
assertEquals("abc", StringUtils.prependIfMissingIgnoreCase("abc", null, (CharSequence[]) null), "prependIfMissingIgnoreCase(abc,null,null)");
|
||||||
assertEquals("xyz", StringUtils.prependIfMissingIgnoreCase("", "xyz", (CharSequence[]) null), "prependIfMissingIgnoreCase(\"\",xyz,null)");
|
assertEquals("xyz", StringUtils.prependIfMissingIgnoreCase("", "xyz", (CharSequence[]) null), "prependIfMissingIgnoreCase(\"\",xyz,null)");
|
||||||
assertEquals("xyzabc", StringUtils.prependIfMissingIgnoreCase("abc", "xyz", new CharSequence[]{null}), "prependIfMissingIgnoreCase(abc,xyz,{null})");
|
assertEquals("xyzabc", StringUtils.prependIfMissingIgnoreCase("abc", "xyz", new CharSequence[]{null}), "prependIfMissingIgnoreCase(abc,xyz,{null})");
|
||||||
|
|
|
@ -101,8 +101,8 @@ static class TestTransientSubObject extends TestObject {
|
||||||
public void testReflectionCompare() {
|
public void testReflectionCompare() {
|
||||||
final TestObject o1 = new TestObject(4);
|
final TestObject o1 = new TestObject(4);
|
||||||
final TestObject o2 = new TestObject(4);
|
final TestObject o2 = new TestObject(4);
|
||||||
assertTrue(CompareToBuilder.reflectionCompare(o1, o1) == 0);
|
assertEquals(0, CompareToBuilder.reflectionCompare(o1, o1));
|
||||||
assertTrue(CompareToBuilder.reflectionCompare(o1, o2) == 0);
|
assertEquals(0, CompareToBuilder.reflectionCompare(o1, o2));
|
||||||
o2.setA(5);
|
o2.setA(5);
|
||||||
assertTrue(CompareToBuilder.reflectionCompare(o1, o2) < 0);
|
assertTrue(CompareToBuilder.reflectionCompare(o1, o2) < 0);
|
||||||
assertTrue(CompareToBuilder.reflectionCompare(o2, o1) > 0);
|
assertTrue(CompareToBuilder.reflectionCompare(o2, o1) > 0);
|
||||||
|
@ -166,9 +166,9 @@ public void testReflectionHierarchyCompareTransients() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertXYZCompareOrder(final Object x, final Object y, final Object z, final boolean testTransients, final String[] excludeFields) {
|
private void assertXYZCompareOrder(final Object x, final Object y, final Object z, final boolean testTransients, final String[] excludeFields) {
|
||||||
assertTrue(0 == CompareToBuilder.reflectionCompare(x, x, testTransients, null, excludeFields));
|
assertEquals(0, CompareToBuilder.reflectionCompare(x, x, testTransients, null, excludeFields));
|
||||||
assertTrue(0 == CompareToBuilder.reflectionCompare(y, y, testTransients, null, excludeFields));
|
assertEquals(0, CompareToBuilder.reflectionCompare(y, y, testTransients, null, excludeFields));
|
||||||
assertTrue(0 == CompareToBuilder.reflectionCompare(z, z, testTransients, null, excludeFields));
|
assertEquals(0, CompareToBuilder.reflectionCompare(z, z, testTransients, null, excludeFields));
|
||||||
|
|
||||||
assertTrue(0 > CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields));
|
assertTrue(0 > CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields));
|
||||||
assertTrue(0 > CompareToBuilder.reflectionCompare(x, z, testTransients, null, excludeFields));
|
assertTrue(0 > CompareToBuilder.reflectionCompare(x, z, testTransients, null, excludeFields));
|
||||||
|
@ -214,7 +214,7 @@ private void testReflectionHierarchyCompare(final boolean testTransients, final
|
||||||
private void assertReflectionCompareContract(final Object x, final Object y, final Object z, final boolean testTransients, final String[] excludeFields) {
|
private void assertReflectionCompareContract(final Object x, final Object y, final Object z, final boolean testTransients, final String[] excludeFields) {
|
||||||
|
|
||||||
// signum
|
// signum
|
||||||
assertTrue(reflectionCompareSignum(x, y, testTransients, excludeFields) == -reflectionCompareSignum(y, x, testTransients, excludeFields));
|
assertEquals(reflectionCompareSignum(x, y, testTransients, excludeFields), -reflectionCompareSignum(y, x, testTransients, excludeFields));
|
||||||
|
|
||||||
// transitive
|
// transitive
|
||||||
if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) > 0
|
if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) > 0
|
||||||
|
@ -224,7 +224,7 @@ private void assertReflectionCompareContract(final Object x, final Object y, fin
|
||||||
|
|
||||||
// un-named
|
// un-named
|
||||||
if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) == 0) {
|
if (CompareToBuilder.reflectionCompare(x, y, testTransients, null, excludeFields) == 0) {
|
||||||
assertTrue(reflectionCompareSignum(x, z, testTransients, excludeFields) == -reflectionCompareSignum(y, z, testTransients, excludeFields));
|
assertEquals(reflectionCompareSignum(x, z, testTransients, excludeFields), -reflectionCompareSignum(y, z, testTransients, excludeFields));
|
||||||
}
|
}
|
||||||
|
|
||||||
// strongly recommended but not strictly required
|
// strongly recommended but not strictly required
|
||||||
|
@ -249,7 +249,7 @@ private int reflectionCompareSignum(final Object lhs, final Object rhs, final bo
|
||||||
public void testAppendSuper() {
|
public void testAppendSuper() {
|
||||||
final TestObject o1 = new TestObject(4);
|
final TestObject o1 = new TestObject(4);
|
||||||
final TestObject o2 = new TestObject(5);
|
final TestObject o2 = new TestObject(5);
|
||||||
assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().appendSuper(0).append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().appendSuper(0).append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().appendSuper(0).append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().appendSuper(0).append(o2, o1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -264,14 +264,14 @@ public void testAppendSuper() {
|
||||||
public void testObject() {
|
public void testObject() {
|
||||||
final TestObject o1 = new TestObject(4);
|
final TestObject o1 = new TestObject(4);
|
||||||
final TestObject o2 = new TestObject(4);
|
final TestObject o2 = new TestObject(4);
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o2).toComparison());
|
||||||
o2.setA(5);
|
o2.setA(5);
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(o1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((Object) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((Object) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, o1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, o1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -301,17 +301,17 @@ public void testObjectEx2() {
|
||||||
public void testObjectComparator() {
|
public void testObjectComparator() {
|
||||||
final String o1 = "Fred";
|
final String o1 = "Fred";
|
||||||
String o2 = "Fred";
|
String o2 = "Fred";
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1, String.CASE_INSENSITIVE_ORDER).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison());
|
||||||
o2 = "FRED";
|
o2 = "FRED";
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o2, o1, String.CASE_INSENSITIVE_ORDER).toComparison());
|
||||||
o2 = "FREDA";
|
o2 = "FREDA";
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2, String.CASE_INSENSITIVE_ORDER).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1, String.CASE_INSENSITIVE_ORDER).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1, String.CASE_INSENSITIVE_ORDER).toComparison() > 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(o1, null, String.CASE_INSENSITIVE_ORDER).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o1, null, String.CASE_INSENSITIVE_ORDER).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(null, null, String.CASE_INSENSITIVE_ORDER).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(null, null, String.CASE_INSENSITIVE_ORDER).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, o1, String.CASE_INSENSITIVE_ORDER).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, o1, String.CASE_INSENSITIVE_ORDER).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,14 +319,14 @@ public void testObjectComparator() {
|
||||||
public void testObjectComparatorNull() {
|
public void testObjectComparatorNull() {
|
||||||
final String o1 = "Fred";
|
final String o1 = "Fred";
|
||||||
String o2 = "Fred";
|
String o2 = "Fred";
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o2, null).toComparison());
|
||||||
o2 = "Zebra";
|
o2 = "Zebra";
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2, null).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2, null).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1, null).toComparison() > 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(o1, null, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o1, null, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(null, null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(null, null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, o1, null).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, o1, null).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ public void testObjectComparatorNull() {
|
||||||
public void testLong() {
|
public void testLong() {
|
||||||
final long o1 = 1L;
|
final long o1 = 1L;
|
||||||
final long o2 = 2L;
|
final long o2 = 2L;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Long.MAX_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, Long.MAX_VALUE).toComparison() < 0);
|
||||||
|
@ -347,7 +347,7 @@ public void testLong() {
|
||||||
public void testInt() {
|
public void testInt() {
|
||||||
final int o1 = 1;
|
final int o1 = 1;
|
||||||
final int o2 = 2;
|
final int o2 = 2;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Integer.MAX_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, Integer.MAX_VALUE).toComparison() < 0);
|
||||||
|
@ -360,7 +360,7 @@ public void testInt() {
|
||||||
public void testShort() {
|
public void testShort() {
|
||||||
final short o1 = 1;
|
final short o1 = 1;
|
||||||
final short o2 = 2;
|
final short o2 = 2;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Short.MAX_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, Short.MAX_VALUE).toComparison() < 0);
|
||||||
|
@ -373,7 +373,7 @@ public void testShort() {
|
||||||
public void testChar() {
|
public void testChar() {
|
||||||
final char o1 = 1;
|
final char o1 = 1;
|
||||||
final char o2 = 2;
|
final char o2 = 2;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Character.MAX_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, Character.MAX_VALUE).toComparison() < 0);
|
||||||
|
@ -386,7 +386,7 @@ public void testChar() {
|
||||||
public void testByte() {
|
public void testByte() {
|
||||||
final byte o1 = 1;
|
final byte o1 = 1;
|
||||||
final byte o2 = 2;
|
final byte o2 = 2;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Byte.MAX_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, Byte.MAX_VALUE).toComparison() < 0);
|
||||||
|
@ -399,14 +399,14 @@ public void testByte() {
|
||||||
public void testDouble() {
|
public void testDouble() {
|
||||||
final double o1 = 1;
|
final double o1 = 1;
|
||||||
final double o2 = 2;
|
final double o2 = 2;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Double.MAX_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, Double.MAX_VALUE).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(Double.MAX_VALUE, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(Double.MAX_VALUE, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Double.MIN_VALUE).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o1, Double.MIN_VALUE).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(Double.MIN_VALUE, o1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(Double.MIN_VALUE, o1).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(Double.NaN, Double.NaN).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(Double.NaN, Double.NaN).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(Double.NaN, Double.MAX_VALUE).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(Double.NaN, Double.MAX_VALUE).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(Double.POSITIVE_INFINITY, Double.MAX_VALUE).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(Double.POSITIVE_INFINITY, Double.MAX_VALUE).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(Double.NEGATIVE_INFINITY, Double.MIN_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(Double.NEGATIVE_INFINITY, Double.MIN_VALUE).toComparison() < 0);
|
||||||
|
@ -420,14 +420,14 @@ public void testDouble() {
|
||||||
public void testFloat() {
|
public void testFloat() {
|
||||||
final float o1 = 1;
|
final float o1 = 1;
|
||||||
final float o2 = 2;
|
final float o2 = 2;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Float.MAX_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o1, Float.MAX_VALUE).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(Float.MAX_VALUE, o1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(Float.MAX_VALUE, o1).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o1, Float.MIN_VALUE).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o1, Float.MIN_VALUE).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(Float.MIN_VALUE, o1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(Float.MIN_VALUE, o1).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(Float.NaN, Float.NaN).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(Float.NaN, Float.NaN).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(Float.NaN, Float.MAX_VALUE).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(Float.NaN, Float.MAX_VALUE).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(Float.POSITIVE_INFINITY, Float.MAX_VALUE).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(Float.POSITIVE_INFINITY, Float.MAX_VALUE).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(Float.NEGATIVE_INFINITY, Float.MIN_VALUE).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(Float.NEGATIVE_INFINITY, Float.MIN_VALUE).toComparison() < 0);
|
||||||
|
@ -441,8 +441,8 @@ public void testFloat() {
|
||||||
public void testBoolean() {
|
public void testBoolean() {
|
||||||
final boolean o1 = true;
|
final boolean o1 = true;
|
||||||
final boolean o2 = false;
|
final boolean o2 = false;
|
||||||
assertTrue(new CompareToBuilder().append(o1, o1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o1, o1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o2, o2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(o2, o2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(o1, o2).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(o2, o1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
@ -460,8 +460,8 @@ public void testObjectArray() {
|
||||||
obj3[1] = new TestObject(5);
|
obj3[1] = new TestObject(5);
|
||||||
obj3[2] = new TestObject(6);
|
obj3[2] = new TestObject(6);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ public void testObjectArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((Object[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((Object[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,8 +487,8 @@ public void testLongArray() {
|
||||||
obj3[1] = 6L;
|
obj3[1] = 6L;
|
||||||
obj3[2] = 7L;
|
obj3[2] = 7L;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -497,7 +497,7 @@ public void testLongArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((long[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((long[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -514,8 +514,8 @@ public void testIntArray() {
|
||||||
obj3[1] = 6;
|
obj3[1] = 6;
|
||||||
obj3[2] = 7;
|
obj3[2] = 7;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -524,7 +524,7 @@ public void testIntArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((int[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((int[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -541,8 +541,8 @@ public void testShortArray() {
|
||||||
obj3[1] = 6;
|
obj3[1] = 6;
|
||||||
obj3[2] = 7;
|
obj3[2] = 7;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -551,7 +551,7 @@ public void testShortArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((short[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((short[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -568,8 +568,8 @@ public void testCharArray() {
|
||||||
obj3[1] = 6;
|
obj3[1] = 6;
|
||||||
obj3[2] = 7;
|
obj3[2] = 7;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -578,7 +578,7 @@ public void testCharArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((char[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((char[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,8 +595,8 @@ public void testByteArray() {
|
||||||
obj3[1] = 6;
|
obj3[1] = 6;
|
||||||
obj3[2] = 7;
|
obj3[2] = 7;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -605,7 +605,7 @@ public void testByteArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((byte[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((byte[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,8 +622,8 @@ public void testDoubleArray() {
|
||||||
obj3[1] = 6;
|
obj3[1] = 6;
|
||||||
obj3[2] = 7;
|
obj3[2] = 7;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ public void testDoubleArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((double[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((double[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,8 +649,8 @@ public void testFloatArray() {
|
||||||
obj3[1] = 6;
|
obj3[1] = 6;
|
||||||
obj3[2] = 7;
|
obj3[2] = 7;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -659,7 +659,7 @@ public void testFloatArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((float[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((float[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,8 +676,8 @@ public void testBooleanArray() {
|
||||||
obj3[1] = false;
|
obj3[1] = false;
|
||||||
obj3[2] = true;
|
obj3[2] = true;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -686,7 +686,7 @@ public void testBooleanArray() {
|
||||||
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj2, obj1).toComparison() < 0);
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj1, null).toComparison() > 0);
|
||||||
assertTrue(new CompareToBuilder().append((boolean[]) null, null).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append((boolean[]) null, null).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(null, obj1).toComparison() < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,8 +705,8 @@ public void testMultiLongArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 200;
|
array1[1][1] = 200;
|
||||||
|
@ -729,8 +729,8 @@ public void testMultiIntArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 200;
|
array1[1][1] = 200;
|
||||||
|
@ -753,8 +753,8 @@ public void testMultiShortArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 200;
|
array1[1][1] = 200;
|
||||||
|
@ -777,8 +777,8 @@ public void testMultiCharArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 200;
|
array1[1][1] = 200;
|
||||||
|
@ -801,8 +801,8 @@ public void testMultiByteArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 127;
|
array1[1][1] = 127;
|
||||||
|
@ -825,8 +825,8 @@ public void testMultiFloatArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 127;
|
array1[1][1] = 127;
|
||||||
|
@ -849,8 +849,8 @@ public void testMultiDoubleArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 127;
|
array1[1][1] = 127;
|
||||||
|
@ -873,8 +873,8 @@ public void testMultiBooleanArray() {
|
||||||
array3[1][2] = false;
|
array3[1][2] = false;
|
||||||
array3[1][2] = false;
|
array3[1][2] = false;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = true;
|
array1[1][1] = true;
|
||||||
|
@ -901,8 +901,8 @@ public void testRaggedArray() {
|
||||||
array3[1][2] = 100;
|
array3[1][2] = 100;
|
||||||
|
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
array1[1][1] = 200;
|
array1[1][1] = 200;
|
||||||
|
@ -927,8 +927,8 @@ public void testMixedArray() {
|
||||||
}
|
}
|
||||||
((long[]) array3[0])[2] = 1;
|
((long[]) array3[0])[2] = 1;
|
||||||
((long[]) array3[1])[2] = 1;
|
((long[]) array3[1])[2] = 1;
|
||||||
assertTrue(new CompareToBuilder().append(array1, array1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(array1, array2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(array1, array3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(array3, array1).toComparison() > 0);
|
||||||
((long[]) array1[1])[1] = 200;
|
((long[]) array1[1])[1] = 200;
|
||||||
|
@ -953,8 +953,8 @@ public void testObjectArrayHiddenByObject() {
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
|
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -978,8 +978,8 @@ public void testLongArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -1003,8 +1003,8 @@ public void testIntArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -1028,8 +1028,8 @@ public void testShortArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -1053,8 +1053,8 @@ public void testCharArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -1078,8 +1078,8 @@ public void testByteArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -1103,8 +1103,8 @@ public void testDoubleArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -1128,8 +1128,8 @@ public void testFloatArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
@ -1153,8 +1153,8 @@ public void testBooleanArrayHiddenByObject() {
|
||||||
final Object obj1 = array1;
|
final Object obj1 = array1;
|
||||||
final Object obj2 = array2;
|
final Object obj2 = array2;
|
||||||
final Object obj3 = array3;
|
final Object obj3 = array3;
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj1).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj1).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj2).toComparison() == 0);
|
assertEquals(0, new CompareToBuilder().append(obj1, obj2).toComparison());
|
||||||
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
assertTrue(new CompareToBuilder().append(obj1, obj3).toComparison() < 0);
|
||||||
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
assertTrue(new CompareToBuilder().append(obj3, obj1).toComparison() > 0);
|
||||||
|
|
||||||
|
|
|
@ -20,9 +20,10 @@
|
||||||
import static org.hamcrest.core.IsEqual.equalTo;
|
import static org.hamcrest.core.IsEqual.equalTo;
|
||||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.hamcrest.Matcher;
|
import org.hamcrest.Matcher;
|
||||||
|
@ -333,8 +334,8 @@ public void testObjectsSameAndEqual() {
|
||||||
left.objectField = sameObject;
|
left.objectField = sameObject;
|
||||||
final TypeTestClass right = new TypeTestClass();
|
final TypeTestClass right = new TypeTestClass();
|
||||||
right.objectField = sameObject;
|
right.objectField = sameObject;
|
||||||
assertTrue(left.objectField == right.objectField);
|
assertSame(left.objectField, right.objectField);
|
||||||
assertTrue(left.objectField.equals(right.objectField));
|
assertEquals(left.objectField, right.objectField);
|
||||||
|
|
||||||
final DiffResult list = left.diff(right);
|
final DiffResult list = left.diff(right);
|
||||||
assertEquals(0, list.getNumberOfDiffs());
|
assertEquals(0, list.getNumberOfDiffs());
|
||||||
|
@ -349,8 +350,8 @@ public void testObjectsNotSameButEqual() {
|
||||||
left.objectField = new Integer(1);
|
left.objectField = new Integer(1);
|
||||||
final TypeTestClass right = new TypeTestClass();
|
final TypeTestClass right = new TypeTestClass();
|
||||||
right.objectField = new Integer(1);
|
right.objectField = new Integer(1);
|
||||||
assertFalse(left.objectField == right.objectField);
|
assertNotSame(left.objectField, right.objectField);
|
||||||
assertTrue(left.objectField.equals(right.objectField));
|
assertEquals(left.objectField, right.objectField);
|
||||||
|
|
||||||
final DiffResult list = left.diff(right);
|
final DiffResult list = left.diff(right);
|
||||||
assertEquals(0, list.getNumberOfDiffs());
|
assertEquals(0, list.getNumberOfDiffs());
|
||||||
|
@ -365,8 +366,8 @@ public void testObjectsNotSameNorEqual() {
|
||||||
left.objectField = 4;
|
left.objectField = 4;
|
||||||
final TypeTestClass right = new TypeTestClass();
|
final TypeTestClass right = new TypeTestClass();
|
||||||
right.objectField = 100;
|
right.objectField = 100;
|
||||||
assertFalse(left.objectField == right.objectField);
|
assertNotSame(left.objectField, right.objectField);
|
||||||
assertFalse(left.objectField.equals(right.objectField));
|
assertNotEquals(left.objectField, right.objectField);
|
||||||
|
|
||||||
final DiffResult list = left.diff(right);
|
final DiffResult list = left.diff(right);
|
||||||
assertEquals(1, list.getNumberOfDiffs());
|
assertEquals(1, list.getNumberOfDiffs());
|
||||||
|
|
|
@ -99,7 +99,7 @@ public void testToStringOutput() {
|
||||||
@Test
|
@Test
|
||||||
public void testToStringSpecifyStyleOutput() {
|
public void testToStringSpecifyStyleOutput() {
|
||||||
final DiffResult list = SIMPLE_FALSE.diff(SIMPLE_TRUE);
|
final DiffResult list = SIMPLE_FALSE.diff(SIMPLE_TRUE);
|
||||||
assertTrue(list.getToStringStyle().equals(SHORT_STYLE));
|
assertEquals(list.getToStringStyle(), SHORT_STYLE);
|
||||||
|
|
||||||
final String lhsString = new ToStringBuilder(SIMPLE_FALSE,
|
final String lhsString = new ToStringBuilder(SIMPLE_FALSE,
|
||||||
ToStringStyle.MULTI_LINE_STYLE).append(
|
ToStringStyle.MULTI_LINE_STYLE).append(
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -1198,10 +1199,10 @@ public void testUnrelatedClasses() {
|
||||||
assertTrue(Arrays.equals(x, y));
|
assertTrue(Arrays.equals(x, y));
|
||||||
assertTrue(Arrays.equals(y, x));
|
assertTrue(Arrays.equals(y, x));
|
||||||
// real tests:
|
// real tests:
|
||||||
assertTrue(x[0].equals(x[0]));
|
assertEquals(x[0], x[0]);
|
||||||
assertTrue(y[0].equals(y[0]));
|
assertEquals(y[0], y[0]);
|
||||||
assertTrue(x[0].equals(y[0]));
|
assertEquals(x[0], y[0]);
|
||||||
assertTrue(y[0].equals(x[0]));
|
assertEquals(y[0], x[0]);
|
||||||
assertTrue(new EqualsBuilder().append(x, x).isEquals());
|
assertTrue(new EqualsBuilder().append(x, x).isEquals());
|
||||||
assertTrue(new EqualsBuilder().append(y, y).isEquals());
|
assertTrue(new EqualsBuilder().append(y, y).isEquals());
|
||||||
assertTrue(new EqualsBuilder().append(x, y).isEquals());
|
assertTrue(new EqualsBuilder().append(x, y).isEquals());
|
||||||
|
@ -1282,11 +1283,11 @@ public void testCyclicalObjectReferences() {
|
||||||
x3.setObjectReference(refX3);
|
x3.setObjectReference(refX3);
|
||||||
refX3.setObjectReference(x3);
|
refX3.setObjectReference(x3);
|
||||||
|
|
||||||
assertTrue(x1.equals(x2));
|
assertEquals(x1, x2);
|
||||||
assertNull(EqualsBuilder.getRegistry());
|
assertNull(EqualsBuilder.getRegistry());
|
||||||
assertFalse(x1.equals(x3));
|
assertNotEquals(x1, x3);
|
||||||
assertNull(EqualsBuilder.getRegistry());
|
assertNull(EqualsBuilder.getRegistry());
|
||||||
assertFalse(x2.equals(x3));
|
assertNotEquals(x2, x3);
|
||||||
assertNull(EqualsBuilder.getRegistry());
|
assertNull(EqualsBuilder.getRegistry());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ private void checkDaemonFlag(final boolean flag) {
|
||||||
final BasicThreadFactory factory = builder.wrappedFactory(wrapped).daemon(
|
final BasicThreadFactory factory = builder.wrappedFactory(wrapped).daemon(
|
||||||
flag).build();
|
flag).build();
|
||||||
assertSame(t, factory.newThread(r), "Wrong thread");
|
assertSame(t, factory.newThread(r), "Wrong thread");
|
||||||
assertTrue(flag == t.isDaemon(), "Wrong daemon flag");
|
assertEquals(flag, t.isDaemon(), "Wrong daemon flag");
|
||||||
EasyMock.verify(wrapped, r);
|
EasyMock.verify(wrapped, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,9 +46,9 @@ public void setUp() {
|
||||||
* @param expected the expected result
|
* @param expected the expected result
|
||||||
*/
|
*/
|
||||||
private void checkEquals(final Object obj, final boolean expected) {
|
private void checkEquals(final Object obj, final boolean expected) {
|
||||||
assertTrue(expected == init.equals(obj), "Wrong result of equals");
|
assertEquals(expected, init.equals(obj), "Wrong result of equals");
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
assertTrue(expected == obj.equals(init), "Not symmetric");
|
assertEquals(expected, obj.equals(init), "Not symmetric");
|
||||||
if (expected) {
|
if (expected) {
|
||||||
assertEquals(init.hashCode(), obj.hashCode(), "Different hash codes");
|
assertEquals(init.hashCode(), obj.hashCode(), "Different hash codes");
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
@ -72,8 +73,8 @@ public void testAddContextValue() {
|
||||||
assertTrue(message.contains("some value"));
|
assertTrue(message.contains("some value"));
|
||||||
assertTrue(message.contains("5"));
|
assertTrue(message.contains("5"));
|
||||||
|
|
||||||
assertTrue(exceptionContext.getFirstContextValue("test1") == null);
|
assertNull(exceptionContext.getFirstContextValue("test1"));
|
||||||
assertTrue(exceptionContext.getFirstContextValue("test2").equals("some value"));
|
assertEquals("some value", exceptionContext.getFirstContextValue("test2"));
|
||||||
|
|
||||||
assertEquals(5, exceptionContext.getContextLabels().size());
|
assertEquals(5, exceptionContext.getContextLabels().size());
|
||||||
assertTrue(exceptionContext.getContextLabels().contains("test1"));
|
assertTrue(exceptionContext.getContextLabels().contains("test1"));
|
||||||
|
@ -99,7 +100,7 @@ public void testSetContextValue() {
|
||||||
assertTrue(message.contains("test Poorly written obj"));
|
assertTrue(message.contains("test Poorly written obj"));
|
||||||
assertTrue(message.contains("Crap"));
|
assertTrue(message.contains("Crap"));
|
||||||
|
|
||||||
assertTrue(exceptionContext.getFirstContextValue("crap") == null);
|
assertNull(exceptionContext.getFirstContextValue("crap"));
|
||||||
assertTrue(exceptionContext.getFirstContextValue("test Poorly written obj") instanceof ObjectWithFaultyToString);
|
assertTrue(exceptionContext.getFirstContextValue("test Poorly written obj") instanceof ObjectWithFaultyToString);
|
||||||
|
|
||||||
assertEquals(7, exceptionContext.getContextEntries().size());
|
assertEquals(7, exceptionContext.getContextEntries().size());
|
||||||
|
@ -126,13 +127,13 @@ public void testSetContextValue() {
|
||||||
public void testGetFirstContextValue() {
|
public void testGetFirstContextValue() {
|
||||||
exceptionContext.addContextValue("test2", "different value");
|
exceptionContext.addContextValue("test2", "different value");
|
||||||
|
|
||||||
assertTrue(exceptionContext.getFirstContextValue("test1") == null);
|
assertNull(exceptionContext.getFirstContextValue("test1"));
|
||||||
assertTrue(exceptionContext.getFirstContextValue("test2").equals("some value"));
|
assertEquals("some value", exceptionContext.getFirstContextValue("test2"));
|
||||||
assertTrue(exceptionContext.getFirstContextValue("crap") == null);
|
assertNull(exceptionContext.getFirstContextValue("crap"));
|
||||||
|
|
||||||
exceptionContext.setContextValue("test2", "another");
|
exceptionContext.setContextValue("test2", "another");
|
||||||
|
|
||||||
assertTrue(exceptionContext.getFirstContextValue("test2").equals("another"));
|
assertEquals("another", exceptionContext.getFirstContextValue("test2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -144,7 +145,7 @@ public void testGetContextValues() {
|
||||||
|
|
||||||
exceptionContext.setContextValue("test2", "another");
|
exceptionContext.setContextValue("test2", "another");
|
||||||
|
|
||||||
assertTrue(exceptionContext.getFirstContextValue("test2").equals("another"));
|
assertEquals("another", exceptionContext.getFirstContextValue("test2"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.apache.commons.lang3.exception;
|
package org.apache.commons.lang3.exception;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -98,7 +99,7 @@ public void testNullExceptionPassing() {
|
||||||
.addContextValue("test Poorly written obj", new ObjectWithFaultyToString());
|
.addContextValue("test Poorly written obj", new ObjectWithFaultyToString());
|
||||||
|
|
||||||
final String message = exceptionContext.getMessage();
|
final String message = exceptionContext.getMessage();
|
||||||
assertTrue(message != null);
|
assertNotNull(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.apache.commons.lang3.exception;
|
package org.apache.commons.lang3.exception;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ public void testNullExceptionPassing() {
|
||||||
.addContextValue("test Poorly written obj", new ObjectWithFaultyToString());
|
.addContextValue("test Poorly written obj", new ObjectWithFaultyToString());
|
||||||
|
|
||||||
final String message = exceptionContext.getMessage();
|
final String message = exceptionContext.getMessage();
|
||||||
assertTrue(message != null);
|
assertNotNull(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
package org.apache.commons.lang3.math;
|
package org.apache.commons.lang3.math;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
@ -621,7 +621,7 @@ public void testPow() {
|
||||||
|
|
||||||
f = Fraction.getFraction(6, 10);
|
f = Fraction.getFraction(6, 10);
|
||||||
assertEquals(f, f.pow(1));
|
assertEquals(f, f.pow(1));
|
||||||
assertFalse(f.pow(1).equals(Fraction.getFraction(3,5)));
|
assertNotEquals(f.pow(1), Fraction.getFraction(3, 5));
|
||||||
|
|
||||||
f = Fraction.getFraction(6, 10);
|
f = Fraction.getFraction(6, 10);
|
||||||
f = f.pow(2);
|
f = f.pow(2);
|
||||||
|
@ -646,11 +646,11 @@ public void testPow() {
|
||||||
// zero to any positive power is still zero.
|
// zero to any positive power is still zero.
|
||||||
f = Fraction.getFraction(0, 1231);
|
f = Fraction.getFraction(0, 1231);
|
||||||
f = f.pow(1);
|
f = f.pow(1);
|
||||||
assertTrue(0==f.compareTo(Fraction.ZERO));
|
assertEquals(0, f.compareTo(Fraction.ZERO));
|
||||||
assertEquals(0, f.getNumerator());
|
assertEquals(0, f.getNumerator());
|
||||||
assertEquals(1231, f.getDenominator());
|
assertEquals(1231, f.getDenominator());
|
||||||
f = f.pow(2);
|
f = f.pow(2);
|
||||||
assertTrue(0==f.compareTo(Fraction.ZERO));
|
assertEquals(0, f.compareTo(Fraction.ZERO));
|
||||||
assertEquals(0, f.getNumerator());
|
assertEquals(0, f.getNumerator());
|
||||||
assertEquals(1, f.getDenominator());
|
assertEquals(1, f.getDenominator());
|
||||||
|
|
||||||
|
@ -994,21 +994,21 @@ public void testEquals() {
|
||||||
Fraction f2 = null;
|
Fraction f2 = null;
|
||||||
|
|
||||||
f1 = Fraction.getFraction(3, 5);
|
f1 = Fraction.getFraction(3, 5);
|
||||||
assertFalse(f1.equals(null));
|
assertNotEquals(null, f1);
|
||||||
assertFalse(f1.equals(new Object()));
|
assertNotEquals(f1, new Object());
|
||||||
assertFalse(f1.equals(Integer.valueOf(6)));
|
assertNotEquals(f1, Integer.valueOf(6));
|
||||||
|
|
||||||
f1 = Fraction.getFraction(3, 5);
|
f1 = Fraction.getFraction(3, 5);
|
||||||
f2 = Fraction.getFraction(2, 5);
|
f2 = Fraction.getFraction(2, 5);
|
||||||
assertFalse(f1.equals(f2));
|
assertNotEquals(f1, f2);
|
||||||
assertTrue(f1.equals(f1));
|
assertEquals(f1, f1);
|
||||||
assertTrue(f2.equals(f2));
|
assertEquals(f2, f2);
|
||||||
|
|
||||||
f2 = Fraction.getFraction(3, 5);
|
f2 = Fraction.getFraction(3, 5);
|
||||||
assertTrue(f1.equals(f2));
|
assertEquals(f1, f2);
|
||||||
|
|
||||||
f2 = Fraction.getFraction(6, 10);
|
f2 = Fraction.getFraction(6, 10);
|
||||||
assertFalse(f1.equals(f2));
|
assertNotEquals(f1, f2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1016,7 +1016,7 @@ public void testHashCode() {
|
||||||
final Fraction f1 = Fraction.getFraction(3, 5);
|
final Fraction f1 = Fraction.getFraction(3, 5);
|
||||||
Fraction f2 = Fraction.getFraction(3, 5);
|
Fraction f2 = Fraction.getFraction(3, 5);
|
||||||
|
|
||||||
assertTrue(f1.hashCode() == f2.hashCode());
|
assertEquals(f1.hashCode(), f2.hashCode());
|
||||||
|
|
||||||
f2 = Fraction.getFraction(2, 5);
|
f2 = Fraction.getFraction(2, 5);
|
||||||
assertTrue(f1.hashCode() != f2.hashCode());
|
assertTrue(f1.hashCode() != f2.hashCode());
|
||||||
|
@ -1031,30 +1031,30 @@ public void testCompareTo() {
|
||||||
Fraction f2 = null;
|
Fraction f2 = null;
|
||||||
|
|
||||||
f1 = Fraction.getFraction(3, 5);
|
f1 = Fraction.getFraction(3, 5);
|
||||||
assertTrue(f1.compareTo(f1) == 0);
|
assertEquals(0, f1.compareTo(f1));
|
||||||
|
|
||||||
final Fraction fr = f1;
|
final Fraction fr = f1;
|
||||||
assertThrows(NullPointerException.class, () -> fr.compareTo(null));
|
assertThrows(NullPointerException.class, () -> fr.compareTo(null));
|
||||||
|
|
||||||
f2 = Fraction.getFraction(2, 5);
|
f2 = Fraction.getFraction(2, 5);
|
||||||
assertTrue(f1.compareTo(f2) > 0);
|
assertTrue(f1.compareTo(f2) > 0);
|
||||||
assertTrue(f2.compareTo(f2) == 0);
|
assertEquals(0, f2.compareTo(f2));
|
||||||
|
|
||||||
f2 = Fraction.getFraction(4, 5);
|
f2 = Fraction.getFraction(4, 5);
|
||||||
assertTrue(f1.compareTo(f2) < 0);
|
assertTrue(f1.compareTo(f2) < 0);
|
||||||
assertTrue(f2.compareTo(f2) == 0);
|
assertEquals(0, f2.compareTo(f2));
|
||||||
|
|
||||||
f2 = Fraction.getFraction(3, 5);
|
f2 = Fraction.getFraction(3, 5);
|
||||||
assertTrue(f1.compareTo(f2) == 0);
|
assertEquals(0, f1.compareTo(f2));
|
||||||
assertTrue(f2.compareTo(f2) == 0);
|
assertEquals(0, f2.compareTo(f2));
|
||||||
|
|
||||||
f2 = Fraction.getFraction(6, 10);
|
f2 = Fraction.getFraction(6, 10);
|
||||||
assertTrue(f1.compareTo(f2) == 0);
|
assertEquals(0, f1.compareTo(f2));
|
||||||
assertTrue(f2.compareTo(f2) == 0);
|
assertEquals(0, f2.compareTo(f2));
|
||||||
|
|
||||||
f2 = Fraction.getFraction(-1, 1, Integer.MAX_VALUE);
|
f2 = Fraction.getFraction(-1, 1, Integer.MAX_VALUE);
|
||||||
assertTrue(f1.compareTo(f2) > 0);
|
assertTrue(f1.compareTo(f2) > 0);
|
||||||
assertTrue(f2.compareTo(f2) == 0);
|
assertEquals(0, f2.compareTo(f2));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -53,10 +54,10 @@ public void testConstructor() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToIntString() {
|
public void testToIntString() {
|
||||||
assertTrue(NumberUtils.toInt("12345") == 12345, "toInt(String) 1 failed");
|
assertEquals(12345, NumberUtils.toInt("12345"), "toInt(String) 1 failed");
|
||||||
assertTrue(NumberUtils.toInt("abc") == 0, "toInt(String) 2 failed");
|
assertEquals(0, NumberUtils.toInt("abc"), "toInt(String) 2 failed");
|
||||||
assertTrue(NumberUtils.toInt("") == 0, "toInt(empty) failed");
|
assertEquals(0, NumberUtils.toInt(""), "toInt(empty) failed");
|
||||||
assertTrue(NumberUtils.toInt(null) == 0, "toInt(null) failed");
|
assertEquals(0, NumberUtils.toInt(null), "toInt(null) failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -64,8 +65,8 @@ public void testToIntString() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToIntStringI() {
|
public void testToIntStringI() {
|
||||||
assertTrue(NumberUtils.toInt("12345", 5) == 12345, "toInt(String,int) 1 failed");
|
assertEquals(12345, NumberUtils.toInt("12345", 5), "toInt(String,int) 1 failed");
|
||||||
assertTrue(NumberUtils.toInt("1234.5", 5) == 5, "toInt(String,int) 2 failed");
|
assertEquals(5, NumberUtils.toInt("1234.5", 5), "toInt(String,int) 2 failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,14 +74,14 @@ public void testToIntStringI() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToLongString() {
|
public void testToLongString() {
|
||||||
assertTrue(NumberUtils.toLong("12345") == 12345L, "toLong(String) 1 failed");
|
assertEquals(12345L, NumberUtils.toLong("12345"), "toLong(String) 1 failed");
|
||||||
assertTrue(NumberUtils.toLong("abc") == 0L, "toLong(String) 2 failed");
|
assertEquals(0L, NumberUtils.toLong("abc"), "toLong(String) 2 failed");
|
||||||
assertTrue(NumberUtils.toLong("1L") == 0L, "toLong(String) 3 failed");
|
assertEquals(0L, NumberUtils.toLong("1L"), "toLong(String) 3 failed");
|
||||||
assertTrue(NumberUtils.toLong("1l") == 0L, "toLong(String) 4 failed");
|
assertEquals(0L, NumberUtils.toLong("1l"), "toLong(String) 4 failed");
|
||||||
assertTrue(NumberUtils.toLong(Long.MAX_VALUE+"") == Long.MAX_VALUE, "toLong(Long.MAX_VALUE) failed");
|
assertEquals(NumberUtils.toLong(Long.MAX_VALUE + ""), Long.MAX_VALUE, "toLong(Long.MAX_VALUE) failed");
|
||||||
assertTrue(NumberUtils.toLong(Long.MIN_VALUE+"") == Long.MIN_VALUE, "toLong(Long.MIN_VALUE) failed");
|
assertEquals(NumberUtils.toLong(Long.MIN_VALUE + ""), Long.MIN_VALUE, "toLong(Long.MIN_VALUE) failed");
|
||||||
assertTrue(NumberUtils.toLong("") == 0L, "toLong(empty) failed");
|
assertEquals(0L, NumberUtils.toLong(""), "toLong(empty) failed");
|
||||||
assertTrue(NumberUtils.toLong(null) == 0L, "toLong(null) failed");
|
assertEquals(0L, NumberUtils.toLong(null), "toLong(null) failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -88,8 +89,8 @@ public void testToLongString() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToLongStringL() {
|
public void testToLongStringL() {
|
||||||
assertTrue(NumberUtils.toLong("12345", 5L) == 12345L, "toLong(String,long) 1 failed");
|
assertEquals(12345L, NumberUtils.toLong("12345", 5L), "toLong(String,long) 1 failed");
|
||||||
assertTrue(NumberUtils.toLong("1234.5", 5L) == 5L, "toLong(String,long) 2 failed");
|
assertEquals(5L, NumberUtils.toLong("1234.5", 5L), "toLong(String,long) 2 failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,10 +205,10 @@ public void testBigIntegerToDoubleBigIntegerD() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToByteString() {
|
public void testToByteString() {
|
||||||
assertTrue(NumberUtils.toByte("123") == 123, "toByte(String) 1 failed");
|
assertEquals(123, NumberUtils.toByte("123"), "toByte(String) 1 failed");
|
||||||
assertTrue(NumberUtils.toByte("abc") == 0, "toByte(String) 2 failed");
|
assertEquals(0, NumberUtils.toByte("abc"), "toByte(String) 2 failed");
|
||||||
assertTrue(NumberUtils.toByte("") == 0, "toByte(empty) failed");
|
assertEquals(0, NumberUtils.toByte(""), "toByte(empty) failed");
|
||||||
assertTrue(NumberUtils.toByte(null) == 0, "toByte(null) failed");
|
assertEquals(0, NumberUtils.toByte(null), "toByte(null) failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -215,8 +216,8 @@ public void testToByteString() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToByteStringI() {
|
public void testToByteStringI() {
|
||||||
assertTrue(NumberUtils.toByte("123", (byte) 5) == 123, "toByte(String,byte) 1 failed");
|
assertEquals(123, NumberUtils.toByte("123", (byte) 5), "toByte(String,byte) 1 failed");
|
||||||
assertTrue(NumberUtils.toByte("12.3", (byte) 5) == 5, "toByte(String,byte) 2 failed");
|
assertEquals(5, NumberUtils.toByte("12.3", (byte) 5), "toByte(String,byte) 2 failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -224,10 +225,10 @@ public void testToByteStringI() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToShortString() {
|
public void testToShortString() {
|
||||||
assertTrue(NumberUtils.toShort("12345") == 12345, "toShort(String) 1 failed");
|
assertEquals(12345, NumberUtils.toShort("12345"), "toShort(String) 1 failed");
|
||||||
assertTrue(NumberUtils.toShort("abc") == 0, "toShort(String) 2 failed");
|
assertEquals(0, NumberUtils.toShort("abc"), "toShort(String) 2 failed");
|
||||||
assertTrue(NumberUtils.toShort("") == 0, "toShort(empty) failed");
|
assertEquals(0, NumberUtils.toShort(""), "toShort(empty) failed");
|
||||||
assertTrue(NumberUtils.toShort(null) == 0, "toShort(null) failed");
|
assertEquals(0, NumberUtils.toShort(null), "toShort(null) failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -235,8 +236,8 @@ public void testToShortString() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToShortStringI() {
|
public void testToShortStringI() {
|
||||||
assertTrue(NumberUtils.toShort("12345", (short) 5) == 12345, "toShort(String,short) 1 failed");
|
assertEquals(12345, NumberUtils.toShort("12345", (short) 5), "toShort(String,short) 1 failed");
|
||||||
assertTrue(NumberUtils.toShort("1234.5", (short) 5) == 5, "toShort(String,short) 2 failed");
|
assertEquals(5, NumberUtils.toShort("1234.5", (short) 5), "toShort(String,short) 2 failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -244,19 +245,13 @@ public void testToShortStringI() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalBigDecimal() {
|
public void testToScaledBigDecimalBigDecimal() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(123.456)).equals(BigDecimal.valueOf(123.46)),
|
assertEquals(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(123.456)), BigDecimal.valueOf(123.46), "toScaledBigDecimal(BigDecimal) 1 failed");
|
||||||
"toScaledBigDecimal(BigDecimal) 1 failed");
|
|
||||||
// Test RoudingMode.HALF_EVEN default rounding.
|
// Test RoudingMode.HALF_EVEN default rounding.
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.515)).equals(BigDecimal.valueOf(23.52)),
|
assertEquals(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.515)), BigDecimal.valueOf(23.52), "toScaledBigDecimal(BigDecimal) 2 failed");
|
||||||
"toScaledBigDecimal(BigDecimal) 2 failed");
|
assertEquals(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525)), BigDecimal.valueOf(23.52), "toScaledBigDecimal(BigDecimal) 3 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525)).equals(BigDecimal.valueOf(23.52)),
|
assertEquals("2352.00", NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525))
|
||||||
"toScaledBigDecimal(BigDecimal) 3 failed");
|
.multiply(BigDecimal.valueOf(100)).toString(), "toScaledBigDecimal(BigDecimal) 4 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525))
|
assertEquals(NumberUtils.toScaledBigDecimal((BigDecimal) null), BigDecimal.ZERO, "toScaledBigDecimal(BigDecimal) 5 failed");
|
||||||
.multiply(BigDecimal.valueOf(100)).toString()
|
|
||||||
.equals("2352.00"),
|
|
||||||
"toScaledBigDecimal(BigDecimal) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((BigDecimal) null).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(BigDecimal) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -264,19 +259,13 @@ public void testToScaledBigDecimalBigDecimal() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalBigDecimalIRM() {
|
public void testToScaledBigDecimalBigDecimalIRM() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(123.456), 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)),
|
assertEquals(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(123.456), 1, RoundingMode.CEILING), BigDecimal.valueOf(123.5), "toScaledBigDecimal(BigDecimal, int, RoudingMode) 1 failed");
|
||||||
"toScaledBigDecimal(BigDecimal, int, RoudingMode) 1 failed");
|
assertEquals(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.5159), 3, RoundingMode.FLOOR), BigDecimal.valueOf(23.515), "toScaledBigDecimal(BigDecimal, int, RoudingMode) 2 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.5159), 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)),
|
assertEquals(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525), 2, RoundingMode.HALF_UP), BigDecimal.valueOf(23.53), "toScaledBigDecimal(BigDecimal, int, RoudingMode) 3 failed");
|
||||||
"toScaledBigDecimal(BigDecimal, int, RoudingMode) 2 failed");
|
assertEquals("23521.0000", NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.521), 4, RoundingMode.HALF_EVEN)
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.525), 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.53)),
|
|
||||||
"toScaledBigDecimal(BigDecimal, int, RoudingMode) 3 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(BigDecimal.valueOf(23.521), 4, RoundingMode.HALF_EVEN)
|
|
||||||
.multiply(BigDecimal.valueOf(1000))
|
.multiply(BigDecimal.valueOf(1000))
|
||||||
.toString()
|
.toString(), "toScaledBigDecimal(BigDecimal, int, RoudingMode) 4 failed");
|
||||||
.equals("23521.0000"),
|
assertEquals(NumberUtils.toScaledBigDecimal((BigDecimal) null, 2, RoundingMode.HALF_UP), BigDecimal.ZERO, "toScaledBigDecimal(BigDecimal, int, RoudingMode) 5 failed");
|
||||||
"toScaledBigDecimal(BigDecimal, int, RoudingMode) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((BigDecimal) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(BigDecimal, int, RoudingMode) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -284,21 +273,15 @@ public void testToScaledBigDecimalBigDecimalIRM() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalFloat() {
|
public void testToScaledBigDecimalFloat() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(123.456f)).equals(BigDecimal.valueOf(123.46)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Float.valueOf(123.456f)), BigDecimal.valueOf(123.46), "toScaledBigDecimal(Float) 1 failed");
|
||||||
"toScaledBigDecimal(Float) 1 failed");
|
|
||||||
// Test RoudingMode.HALF_EVEN default rounding.
|
// Test RoudingMode.HALF_EVEN default rounding.
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(23.515f)).equals(BigDecimal.valueOf(23.51)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Float.valueOf(23.515f)), BigDecimal.valueOf(23.51), "toScaledBigDecimal(Float) 2 failed");
|
||||||
"toScaledBigDecimal(Float) 2 failed");
|
|
||||||
// Note. NumberUtils.toScaledBigDecimal(Float.valueOf(23.515f)).equals(BigDecimal.valueOf(23.51))
|
// Note. NumberUtils.toScaledBigDecimal(Float.valueOf(23.515f)).equals(BigDecimal.valueOf(23.51))
|
||||||
// because of roundoff error. It is ok.
|
// because of roundoff error. It is ok.
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f)).equals(BigDecimal.valueOf(23.52)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f)), BigDecimal.valueOf(23.52), "toScaledBigDecimal(Float) 3 failed");
|
||||||
"toScaledBigDecimal(Float) 3 failed");
|
assertEquals("2352.00", NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f))
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f))
|
.multiply(BigDecimal.valueOf(100)).toString(), "toScaledBigDecimal(Float) 4 failed");
|
||||||
.multiply(BigDecimal.valueOf(100)).toString()
|
assertEquals(NumberUtils.toScaledBigDecimal((Float) null), BigDecimal.ZERO, "toScaledBigDecimal(Float) 5 failed");
|
||||||
.equals("2352.00"),
|
|
||||||
"toScaledBigDecimal(Float) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((Float) null).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(Float) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,20 +289,14 @@ public void testToScaledBigDecimalFloat() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalFloatIRM() {
|
public void testToScaledBigDecimalFloatIRM() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(123.456f), 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Float.valueOf(123.456f), 1, RoundingMode.CEILING), BigDecimal.valueOf(123.5), "toScaledBigDecimal(Float, int, RoudingMode) 1 failed");
|
||||||
"toScaledBigDecimal(Float, int, RoudingMode) 1 failed");
|
assertEquals(NumberUtils.toScaledBigDecimal(Float.valueOf(23.5159f), 3, RoundingMode.FLOOR), BigDecimal.valueOf(23.515), "toScaledBigDecimal(Float, int, RoudingMode) 2 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(23.5159f), 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)),
|
|
||||||
"toScaledBigDecimal(Float, int, RoudingMode) 2 failed");
|
|
||||||
// The following happens due to roundoff error. We're ok with this.
|
// The following happens due to roundoff error. We're ok with this.
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f), 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.52)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Float.valueOf(23.525f), 2, RoundingMode.HALF_UP), BigDecimal.valueOf(23.52), "toScaledBigDecimal(Float, int, RoudingMode) 3 failed");
|
||||||
"toScaledBigDecimal(Float, int, RoudingMode) 3 failed");
|
assertEquals("23521.0000", NumberUtils.toScaledBigDecimal(Float.valueOf(23.521f), 4, RoundingMode.HALF_EVEN)
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Float.valueOf(23.521f), 4, RoundingMode.HALF_EVEN)
|
|
||||||
.multiply(BigDecimal.valueOf(1000))
|
.multiply(BigDecimal.valueOf(1000))
|
||||||
.toString()
|
.toString(), "toScaledBigDecimal(Float, int, RoudingMode) 4 failed");
|
||||||
.equals("23521.0000"),
|
assertEquals(NumberUtils.toScaledBigDecimal((Float) null, 2, RoundingMode.HALF_UP), BigDecimal.ZERO, "toScaledBigDecimal(Float, int, RoudingMode) 5 failed");
|
||||||
"toScaledBigDecimal(Float, int, RoudingMode) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((Float) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(Float, int, RoudingMode) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -327,19 +304,13 @@ public void testToScaledBigDecimalFloatIRM() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalDouble() {
|
public void testToScaledBigDecimalDouble() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(123.456d)).equals(BigDecimal.valueOf(123.46)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Double.valueOf(123.456d)), BigDecimal.valueOf(123.46), "toScaledBigDecimal(Double) 1 failed");
|
||||||
"toScaledBigDecimal(Double) 1 failed");
|
|
||||||
// Test RoudingMode.HALF_EVEN default rounding.
|
// Test RoudingMode.HALF_EVEN default rounding.
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(23.515d)).equals(BigDecimal.valueOf(23.52)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Double.valueOf(23.515d)), BigDecimal.valueOf(23.52), "toScaledBigDecimal(Double) 2 failed");
|
||||||
"toScaledBigDecimal(Double) 2 failed");
|
assertEquals(NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d)), BigDecimal.valueOf(23.52), "toScaledBigDecimal(Double) 3 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d)).equals(BigDecimal.valueOf(23.52)),
|
assertEquals("2352.00", NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d))
|
||||||
"toScaledBigDecimal(Double) 3 failed");
|
.multiply(BigDecimal.valueOf(100)).toString(), "toScaledBigDecimal(Double) 4 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d))
|
assertEquals(NumberUtils.toScaledBigDecimal((Double) null), BigDecimal.ZERO, "toScaledBigDecimal(Double) 5 failed");
|
||||||
.multiply(BigDecimal.valueOf(100)).toString()
|
|
||||||
.equals("2352.00"),
|
|
||||||
"toScaledBigDecimal(Double) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((Double) null).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(Double) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -347,19 +318,13 @@ public void testToScaledBigDecimalDouble() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalDoubleIRM() {
|
public void testToScaledBigDecimalDoubleIRM() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(123.456d), 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Double.valueOf(123.456d), 1, RoundingMode.CEILING), BigDecimal.valueOf(123.5), "toScaledBigDecimal(Double, int, RoudingMode) 1 failed");
|
||||||
"toScaledBigDecimal(Double, int, RoudingMode) 1 failed");
|
assertEquals(NumberUtils.toScaledBigDecimal(Double.valueOf(23.5159d), 3, RoundingMode.FLOOR), BigDecimal.valueOf(23.515), "toScaledBigDecimal(Double, int, RoudingMode) 2 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(23.5159d), 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)),
|
assertEquals(NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d), 2, RoundingMode.HALF_UP), BigDecimal.valueOf(23.53), "toScaledBigDecimal(Double, int, RoudingMode) 3 failed");
|
||||||
"toScaledBigDecimal(Double, int, RoudingMode) 2 failed");
|
assertEquals("23521.0000", NumberUtils.toScaledBigDecimal(Double.valueOf(23.521d), 4, RoundingMode.HALF_EVEN)
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(23.525d), 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.53)),
|
|
||||||
"toScaledBigDecimal(Double, int, RoudingMode) 3 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal(Double.valueOf(23.521d), 4, RoundingMode.HALF_EVEN)
|
|
||||||
.multiply(BigDecimal.valueOf(1000))
|
.multiply(BigDecimal.valueOf(1000))
|
||||||
.toString()
|
.toString(), "toScaledBigDecimal(Double, int, RoudingMode) 4 failed");
|
||||||
.equals("23521.0000"),
|
assertEquals(NumberUtils.toScaledBigDecimal((Double) null, 2, RoundingMode.HALF_UP), BigDecimal.ZERO, "toScaledBigDecimal(Double, int, RoudingMode) 5 failed");
|
||||||
"toScaledBigDecimal(Double, int, RoudingMode) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((Double) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(Double, int, RoudingMode) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -367,19 +332,13 @@ public void testToScaledBigDecimalDoubleIRM() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalString() {
|
public void testToScaledBigDecimalString() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("123.456").equals(BigDecimal.valueOf(123.46)),
|
assertEquals(NumberUtils.toScaledBigDecimal("123.456"), BigDecimal.valueOf(123.46), "toScaledBigDecimal(String) 1 failed");
|
||||||
"toScaledBigDecimal(String) 1 failed");
|
|
||||||
// Test RoudingMode.HALF_EVEN default rounding.
|
// Test RoudingMode.HALF_EVEN default rounding.
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("23.515").equals(BigDecimal.valueOf(23.52)),
|
assertEquals(NumberUtils.toScaledBigDecimal("23.515"), BigDecimal.valueOf(23.52), "toScaledBigDecimal(String) 2 failed");
|
||||||
"toScaledBigDecimal(String) 2 failed");
|
assertEquals(NumberUtils.toScaledBigDecimal("23.525"), BigDecimal.valueOf(23.52), "toScaledBigDecimal(String) 3 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("23.525").equals(BigDecimal.valueOf(23.52)),
|
assertEquals("2352.00", NumberUtils.toScaledBigDecimal("23.525")
|
||||||
"toScaledBigDecimal(String) 3 failed");
|
.multiply(BigDecimal.valueOf(100)).toString(), "toScaledBigDecimal(String) 4 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("23.525")
|
assertEquals(NumberUtils.toScaledBigDecimal((String) null), BigDecimal.ZERO, "toScaledBigDecimal(String) 5 failed");
|
||||||
.multiply(BigDecimal.valueOf(100)).toString()
|
|
||||||
.equals("2352.00"),
|
|
||||||
"toScaledBigDecimal(String) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((String) null).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(String) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -387,19 +346,13 @@ public void testToScaledBigDecimalString() {
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToScaledBigDecimalStringIRM() {
|
public void testToScaledBigDecimalStringIRM() {
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("123.456", 1, RoundingMode.CEILING).equals(BigDecimal.valueOf(123.5)),
|
assertEquals(NumberUtils.toScaledBigDecimal("123.456", 1, RoundingMode.CEILING), BigDecimal.valueOf(123.5), "toScaledBigDecimal(String, int, RoudingMode) 1 failed");
|
||||||
"toScaledBigDecimal(String, int, RoudingMode) 1 failed");
|
assertEquals(NumberUtils.toScaledBigDecimal("23.5159", 3, RoundingMode.FLOOR), BigDecimal.valueOf(23.515), "toScaledBigDecimal(String, int, RoudingMode) 2 failed");
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("23.5159", 3, RoundingMode.FLOOR).equals(BigDecimal.valueOf(23.515)),
|
assertEquals(NumberUtils.toScaledBigDecimal("23.525", 2, RoundingMode.HALF_UP), BigDecimal.valueOf(23.53), "toScaledBigDecimal(String, int, RoudingMode) 3 failed");
|
||||||
"toScaledBigDecimal(String, int, RoudingMode) 2 failed");
|
assertEquals("23521.0000", NumberUtils.toScaledBigDecimal("23.521", 4, RoundingMode.HALF_EVEN)
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("23.525", 2, RoundingMode.HALF_UP).equals(BigDecimal.valueOf(23.53)),
|
|
||||||
"toScaledBigDecimal(String, int, RoudingMode) 3 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal("23.521", 4, RoundingMode.HALF_EVEN)
|
|
||||||
.multiply(BigDecimal.valueOf(1000))
|
.multiply(BigDecimal.valueOf(1000))
|
||||||
.toString()
|
.toString(), "toScaledBigDecimal(String, int, RoudingMode) 4 failed");
|
||||||
.equals("23521.0000"),
|
assertEquals(NumberUtils.toScaledBigDecimal((String) null, 2, RoundingMode.HALF_UP), BigDecimal.ZERO, "toScaledBigDecimal(String, int, RoudingMode) 5 failed");
|
||||||
"toScaledBigDecimal(String, int, RoudingMode) 4 failed");
|
|
||||||
assertTrue(NumberUtils.toScaledBigDecimal((String) null, 2, RoundingMode.HALF_UP).equals(BigDecimal.ZERO),
|
|
||||||
"toScaledBigDecimal(String, int, RoudingMode) 5 failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -417,15 +370,15 @@ public void testCreateNumber() {
|
||||||
assertEquals(Long.valueOf(12345), NumberUtils.createNumber("12345l"), "createNumber(String) 6 failed");
|
assertEquals(Long.valueOf(12345), NumberUtils.createNumber("12345l"), "createNumber(String) 6 failed");
|
||||||
assertEquals(Float.valueOf("-1234.5"), NumberUtils.createNumber("-1234.5"), "createNumber(String) 7 failed");
|
assertEquals(Float.valueOf("-1234.5"), NumberUtils.createNumber("-1234.5"), "createNumber(String) 7 failed");
|
||||||
assertEquals(Integer.valueOf("-12345"), NumberUtils.createNumber("-12345"), "createNumber(String) 8 failed");
|
assertEquals(Integer.valueOf("-12345"), NumberUtils.createNumber("-12345"), "createNumber(String) 8 failed");
|
||||||
assertTrue(0xFADE == NumberUtils.createNumber("0xFADE").intValue(), "createNumber(String) 9a failed");
|
assertEquals(0xFADE, NumberUtils.createNumber("0xFADE").intValue(), "createNumber(String) 9a failed");
|
||||||
assertTrue(0xFADE == NumberUtils.createNumber("0Xfade").intValue(), "createNumber(String) 9b failed");
|
assertEquals(0xFADE, NumberUtils.createNumber("0Xfade").intValue(), "createNumber(String) 9b failed");
|
||||||
assertTrue(-0xFADE == NumberUtils.createNumber("-0xFADE").intValue(), "createNumber(String) 10a failed");
|
assertEquals(-0xFADE, NumberUtils.createNumber("-0xFADE").intValue(), "createNumber(String) 10a failed");
|
||||||
assertTrue(-0xFADE == NumberUtils.createNumber("-0Xfade").intValue(), "createNumber(String) 10b failed");
|
assertEquals(-0xFADE, NumberUtils.createNumber("-0Xfade").intValue(), "createNumber(String) 10b failed");
|
||||||
assertEquals(Double.valueOf("1.1E200"), NumberUtils.createNumber("1.1E200"), "createNumber(String) 11 failed");
|
assertEquals(Double.valueOf("1.1E200"), NumberUtils.createNumber("1.1E200"), "createNumber(String) 11 failed");
|
||||||
assertEquals(Float.valueOf("1.1E20"), NumberUtils.createNumber("1.1E20"), "createNumber(String) 12 failed");
|
assertEquals(Float.valueOf("1.1E20"), NumberUtils.createNumber("1.1E20"), "createNumber(String) 12 failed");
|
||||||
assertEquals(Double.valueOf("-1.1E200"), NumberUtils.createNumber("-1.1E200"), "createNumber(String) 13 failed");
|
assertEquals(Double.valueOf("-1.1E200"), NumberUtils.createNumber("-1.1E200"), "createNumber(String) 13 failed");
|
||||||
assertEquals(Double.valueOf("1.1E-200"), NumberUtils.createNumber("1.1E-200"), "createNumber(String) 14 failed");
|
assertEquals(Double.valueOf("1.1E-200"), NumberUtils.createNumber("1.1E-200"), "createNumber(String) 14 failed");
|
||||||
assertEquals(null, NumberUtils.createNumber(null), "createNumber(null) failed");
|
assertNull(NumberUtils.createNumber(null), "createNumber(null) failed");
|
||||||
assertEquals(new BigInteger("12345678901234567890"), NumberUtils.createNumber("12345678901234567890L"), "createNumber(String) failed");
|
assertEquals(new BigInteger("12345678901234567890"), NumberUtils.createNumber("12345678901234567890L"), "createNumber(String) failed");
|
||||||
|
|
||||||
assertEquals(new BigDecimal("1.1E-700"), NumberUtils.createNumber("1.1E-700F"), "createNumber(String) 15 failed");
|
assertEquals(new BigDecimal("1.1E-700"), NumberUtils.createNumber("1.1E-700F"), "createNumber(String) 15 failed");
|
||||||
|
@ -606,7 +559,7 @@ public void testCreateNumberMagnitude() {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateFloat() {
|
public void testCreateFloat() {
|
||||||
assertEquals(Float.valueOf("1234.5"), NumberUtils.createFloat("1234.5"), "createFloat(String) failed");
|
assertEquals(Float.valueOf("1234.5"), NumberUtils.createFloat("1234.5"), "createFloat(String) failed");
|
||||||
assertEquals(null, NumberUtils.createFloat(null), "createFloat(null) failed");
|
assertNull(NumberUtils.createFloat(null), "createFloat(null) failed");
|
||||||
this.testCreateFloatFailure("");
|
this.testCreateFloatFailure("");
|
||||||
this.testCreateFloatFailure(" ");
|
this.testCreateFloatFailure(" ");
|
||||||
this.testCreateFloatFailure("\b\t\n\f\r");
|
this.testCreateFloatFailure("\b\t\n\f\r");
|
||||||
|
@ -623,7 +576,7 @@ protected void testCreateFloatFailure(final String str) {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateDouble() {
|
public void testCreateDouble() {
|
||||||
assertEquals(Double.valueOf("1234.5"), NumberUtils.createDouble("1234.5"), "createDouble(String) failed");
|
assertEquals(Double.valueOf("1234.5"), NumberUtils.createDouble("1234.5"), "createDouble(String) failed");
|
||||||
assertEquals(null, NumberUtils.createDouble(null), "createDouble(null) failed");
|
assertNull(NumberUtils.createDouble(null), "createDouble(null) failed");
|
||||||
this.testCreateDoubleFailure("");
|
this.testCreateDoubleFailure("");
|
||||||
this.testCreateDoubleFailure(" ");
|
this.testCreateDoubleFailure(" ");
|
||||||
this.testCreateDoubleFailure("\b\t\n\f\r");
|
this.testCreateDoubleFailure("\b\t\n\f\r");
|
||||||
|
@ -641,7 +594,7 @@ protected void testCreateDoubleFailure(final String str) {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateInteger() {
|
public void testCreateInteger() {
|
||||||
assertEquals(Integer.valueOf("12345"), NumberUtils.createInteger("12345"), "createInteger(String) failed");
|
assertEquals(Integer.valueOf("12345"), NumberUtils.createInteger("12345"), "createInteger(String) failed");
|
||||||
assertEquals(null, NumberUtils.createInteger(null), "createInteger(null) failed");
|
assertNull(NumberUtils.createInteger(null), "createInteger(null) failed");
|
||||||
this.testCreateIntegerFailure("");
|
this.testCreateIntegerFailure("");
|
||||||
this.testCreateIntegerFailure(" ");
|
this.testCreateIntegerFailure(" ");
|
||||||
this.testCreateIntegerFailure("\b\t\n\f\r");
|
this.testCreateIntegerFailure("\b\t\n\f\r");
|
||||||
|
@ -659,7 +612,7 @@ protected void testCreateIntegerFailure(final String str) {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateLong() {
|
public void testCreateLong() {
|
||||||
assertEquals(Long.valueOf("12345"), NumberUtils.createLong("12345"), "createLong(String) failed");
|
assertEquals(Long.valueOf("12345"), NumberUtils.createLong("12345"), "createLong(String) failed");
|
||||||
assertEquals(null, NumberUtils.createLong(null), "createLong(null) failed");
|
assertNull(NumberUtils.createLong(null), "createLong(null) failed");
|
||||||
this.testCreateLongFailure("");
|
this.testCreateLongFailure("");
|
||||||
this.testCreateLongFailure(" ");
|
this.testCreateLongFailure(" ");
|
||||||
this.testCreateLongFailure("\b\t\n\f\r");
|
this.testCreateLongFailure("\b\t\n\f\r");
|
||||||
|
@ -677,7 +630,7 @@ protected void testCreateLongFailure(final String str) {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateBigInteger() {
|
public void testCreateBigInteger() {
|
||||||
assertEquals(new BigInteger("12345"), NumberUtils.createBigInteger("12345"), "createBigInteger(String) failed");
|
assertEquals(new BigInteger("12345"), NumberUtils.createBigInteger("12345"), "createBigInteger(String) failed");
|
||||||
assertEquals(null, NumberUtils.createBigInteger(null), "createBigInteger(null) failed");
|
assertNull(NumberUtils.createBigInteger(null), "createBigInteger(null) failed");
|
||||||
this.testCreateBigIntegerFailure("");
|
this.testCreateBigIntegerFailure("");
|
||||||
this.testCreateBigIntegerFailure(" ");
|
this.testCreateBigIntegerFailure(" ");
|
||||||
this.testCreateBigIntegerFailure("\b\t\n\f\r");
|
this.testCreateBigIntegerFailure("\b\t\n\f\r");
|
||||||
|
@ -708,7 +661,7 @@ protected void testCreateBigIntegerFailure(final String str) {
|
||||||
@Test
|
@Test
|
||||||
public void testCreateBigDecimal() {
|
public void testCreateBigDecimal() {
|
||||||
assertEquals(new BigDecimal("1234.5"), NumberUtils.createBigDecimal("1234.5"), "createBigDecimal(String) failed");
|
assertEquals(new BigDecimal("1234.5"), NumberUtils.createBigDecimal("1234.5"), "createBigDecimal(String) failed");
|
||||||
assertEquals(null, NumberUtils.createBigDecimal(null), "createBigDecimal(null) failed");
|
assertNull(NumberUtils.createBigDecimal(null), "createBigDecimal(null) failed");
|
||||||
this.testCreateBigDecimalFailure("");
|
this.testCreateBigDecimalFailure("");
|
||||||
this.testCreateBigDecimalFailure(" ");
|
this.testCreateBigDecimalFailure(" ");
|
||||||
this.testCreateBigDecimalFailure("\b\t\n\f\r");
|
this.testCreateBigDecimalFailure("\b\t\n\f\r");
|
||||||
|
@ -1111,188 +1064,188 @@ public void testMaximumFloat() {
|
||||||
// Testing JDK against old Lang functionality
|
// Testing JDK against old Lang functionality
|
||||||
@Test
|
@Test
|
||||||
public void testCompareDouble() {
|
public void testCompareDouble() {
|
||||||
assertTrue(Double.compare(Double.NaN, Double.NaN) == 0);
|
assertEquals(0, Double.compare(Double.NaN, Double.NaN));
|
||||||
assertTrue(Double.compare(Double.NaN, Double.POSITIVE_INFINITY) == +1);
|
assertEquals(Double.compare(Double.NaN, Double.POSITIVE_INFINITY), +1);
|
||||||
assertTrue(Double.compare(Double.NaN, Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(Double.NaN, Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(Double.NaN, 1.2d) == +1);
|
assertEquals(Double.compare(Double.NaN, 1.2d), +1);
|
||||||
assertTrue(Double.compare(Double.NaN, 0.0d) == +1);
|
assertEquals(Double.compare(Double.NaN, 0.0d), +1);
|
||||||
assertTrue(Double.compare(Double.NaN, -0.0d) == +1);
|
assertEquals(Double.compare(Double.NaN, -0.0d), +1);
|
||||||
assertTrue(Double.compare(Double.NaN, -1.2d) == +1);
|
assertEquals(Double.compare(Double.NaN, -1.2d), +1);
|
||||||
assertTrue(Double.compare(Double.NaN, -Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(Double.NaN, -Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(Double.NaN, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(Double.NaN, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.NaN) == -1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY) == 0);
|
assertEquals(0, Double.compare(Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY));
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, 1.2d) == +1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, 1.2d), +1);
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, 0.0d) == +1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, 0.0d), +1);
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -0.0d) == +1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, -0.0d), +1);
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -1.2d) == +1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, -1.2d), +1);
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, -Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, -Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, Double.NaN) == -1);
|
assertEquals(Double.compare(Double.MAX_VALUE, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
|
assertEquals(Double.compare(Double.MAX_VALUE, Double.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, Double.MAX_VALUE) == 0);
|
assertEquals(0, Double.compare(Double.MAX_VALUE, Double.MAX_VALUE));
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, 1.2d) == +1);
|
assertEquals(Double.compare(Double.MAX_VALUE, 1.2d), +1);
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, 0.0d) == +1);
|
assertEquals(Double.compare(Double.MAX_VALUE, 0.0d), +1);
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, -0.0d) == +1);
|
assertEquals(Double.compare(Double.MAX_VALUE, -0.0d), +1);
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, -1.2d) == +1);
|
assertEquals(Double.compare(Double.MAX_VALUE, -1.2d), +1);
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, -Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(Double.MAX_VALUE, -Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(Double.MAX_VALUE, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(1.2d, Double.NaN) == -1);
|
assertEquals(Double.compare(1.2d, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(1.2d, Double.POSITIVE_INFINITY) == -1);
|
assertEquals(Double.compare(1.2d, Double.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Double.compare(1.2d, Double.MAX_VALUE) == -1);
|
assertEquals(Double.compare(1.2d, Double.MAX_VALUE), -1);
|
||||||
assertTrue(Double.compare(1.2d, 1.2d) == 0);
|
assertEquals(0, Double.compare(1.2d, 1.2d));
|
||||||
assertTrue(Double.compare(1.2d, 0.0d) == +1);
|
assertEquals(Double.compare(1.2d, 0.0d), +1);
|
||||||
assertTrue(Double.compare(1.2d, -0.0d) == +1);
|
assertEquals(Double.compare(1.2d, -0.0d), +1);
|
||||||
assertTrue(Double.compare(1.2d, -1.2d) == +1);
|
assertEquals(Double.compare(1.2d, -1.2d), +1);
|
||||||
assertTrue(Double.compare(1.2d, -Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(1.2d, -Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(1.2d, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(1.2d, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(0.0d, Double.NaN) == -1);
|
assertEquals(Double.compare(0.0d, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(0.0d, Double.POSITIVE_INFINITY) == -1);
|
assertEquals(Double.compare(0.0d, Double.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Double.compare(0.0d, Double.MAX_VALUE) == -1);
|
assertEquals(Double.compare(0.0d, Double.MAX_VALUE), -1);
|
||||||
assertTrue(Double.compare(0.0d, 1.2d) == -1);
|
assertEquals(Double.compare(0.0d, 1.2d), -1);
|
||||||
assertTrue(Double.compare(0.0d, 0.0d) == 0);
|
assertEquals(0, Double.compare(0.0d, 0.0d));
|
||||||
assertTrue(Double.compare(0.0d, -0.0d) == +1);
|
assertEquals(Double.compare(0.0d, -0.0d), +1);
|
||||||
assertTrue(Double.compare(0.0d, -1.2d) == +1);
|
assertEquals(Double.compare(0.0d, -1.2d), +1);
|
||||||
assertTrue(Double.compare(0.0d, -Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(0.0d, -Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(0.0d, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(0.0d, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(-0.0d, Double.NaN) == -1);
|
assertEquals(Double.compare(-0.0d, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(-0.0d, Double.POSITIVE_INFINITY) == -1);
|
assertEquals(Double.compare(-0.0d, Double.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Double.compare(-0.0d, Double.MAX_VALUE) == -1);
|
assertEquals(Double.compare(-0.0d, Double.MAX_VALUE), -1);
|
||||||
assertTrue(Double.compare(-0.0d, 1.2d) == -1);
|
assertEquals(Double.compare(-0.0d, 1.2d), -1);
|
||||||
assertTrue(Double.compare(-0.0d, 0.0d) == -1);
|
assertEquals(Double.compare(-0.0d, 0.0d), -1);
|
||||||
assertTrue(Double.compare(-0.0d, -0.0d) == 0);
|
assertEquals(0, Double.compare(-0.0d, -0.0d));
|
||||||
assertTrue(Double.compare(-0.0d, -1.2d) == +1);
|
assertEquals(Double.compare(-0.0d, -1.2d), +1);
|
||||||
assertTrue(Double.compare(-0.0d, -Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(-0.0d, -Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(-0.0d, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(-0.0d, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(-1.2d, Double.NaN) == -1);
|
assertEquals(Double.compare(-1.2d, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(-1.2d, Double.POSITIVE_INFINITY) == -1);
|
assertEquals(Double.compare(-1.2d, Double.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Double.compare(-1.2d, Double.MAX_VALUE) == -1);
|
assertEquals(Double.compare(-1.2d, Double.MAX_VALUE), -1);
|
||||||
assertTrue(Double.compare(-1.2d, 1.2d) == -1);
|
assertEquals(Double.compare(-1.2d, 1.2d), -1);
|
||||||
assertTrue(Double.compare(-1.2d, 0.0d) == -1);
|
assertEquals(Double.compare(-1.2d, 0.0d), -1);
|
||||||
assertTrue(Double.compare(-1.2d, -0.0d) == -1);
|
assertEquals(Double.compare(-1.2d, -0.0d), -1);
|
||||||
assertTrue(Double.compare(-1.2d, -1.2d) == 0);
|
assertEquals(0, Double.compare(-1.2d, -1.2d));
|
||||||
assertTrue(Double.compare(-1.2d, -Double.MAX_VALUE) == +1);
|
assertEquals(Double.compare(-1.2d, -Double.MAX_VALUE), +1);
|
||||||
assertTrue(Double.compare(-1.2d, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(-1.2d, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, Double.NaN) == -1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, Double.POSITIVE_INFINITY) == -1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, Double.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, Double.MAX_VALUE) == -1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, Double.MAX_VALUE), -1);
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, 1.2d) == -1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, 1.2d), -1);
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, 0.0d) == -1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, 0.0d), -1);
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, -0.0d) == -1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, -0.0d), -1);
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, -1.2d) == -1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, -1.2d), -1);
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, -Double.MAX_VALUE) == 0);
|
assertEquals(0, Double.compare(-Double.MAX_VALUE, -Double.MAX_VALUE));
|
||||||
assertTrue(Double.compare(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY) == +1);
|
assertEquals(Double.compare(-Double.MAX_VALUE, Double.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.NaN) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, Double.NaN), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.MAX_VALUE) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, Double.MAX_VALUE), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, 1.2d) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, 1.2d), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, 0.0d) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, 0.0d), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -0.0d) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, -0.0d), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -1.2d) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, -1.2d), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE) == -1);
|
assertEquals(Double.compare(Double.NEGATIVE_INFINITY, -Double.MAX_VALUE), -1);
|
||||||
assertTrue(Double.compare(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY) == 0);
|
assertEquals(0, Double.compare(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompareFloat() {
|
public void testCompareFloat() {
|
||||||
assertTrue(Float.compare(Float.NaN, Float.NaN) == 0);
|
assertEquals(0, Float.compare(Float.NaN, Float.NaN));
|
||||||
assertTrue(Float.compare(Float.NaN, Float.POSITIVE_INFINITY) == +1);
|
assertEquals(Float.compare(Float.NaN, Float.POSITIVE_INFINITY), +1);
|
||||||
assertTrue(Float.compare(Float.NaN, Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(Float.NaN, Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(Float.NaN, 1.2f) == +1);
|
assertEquals(Float.compare(Float.NaN, 1.2f), +1);
|
||||||
assertTrue(Float.compare(Float.NaN, 0.0f) == +1);
|
assertEquals(Float.compare(Float.NaN, 0.0f), +1);
|
||||||
assertTrue(Float.compare(Float.NaN, -0.0f) == +1);
|
assertEquals(Float.compare(Float.NaN, -0.0f), +1);
|
||||||
assertTrue(Float.compare(Float.NaN, -1.2f) == +1);
|
assertEquals(Float.compare(Float.NaN, -1.2f), +1);
|
||||||
assertTrue(Float.compare(Float.NaN, -Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(Float.NaN, -Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(Float.NaN, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(Float.NaN, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.NaN) == -1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY) == 0);
|
assertEquals(0, Float.compare(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY));
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, 1.2f) == +1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, 1.2f), +1);
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, 0.0f) == +1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, 0.0f), +1);
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -0.0f) == +1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, -0.0f), +1);
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -1.2f) == +1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, -1.2f), +1);
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, -Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, -Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, Float.NaN) == -1);
|
assertEquals(Float.compare(Float.MAX_VALUE, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
|
assertEquals(Float.compare(Float.MAX_VALUE, Float.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, Float.MAX_VALUE) == 0);
|
assertEquals(0, Float.compare(Float.MAX_VALUE, Float.MAX_VALUE));
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, 1.2f) == +1);
|
assertEquals(Float.compare(Float.MAX_VALUE, 1.2f), +1);
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, 0.0f) == +1);
|
assertEquals(Float.compare(Float.MAX_VALUE, 0.0f), +1);
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, -0.0f) == +1);
|
assertEquals(Float.compare(Float.MAX_VALUE, -0.0f), +1);
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, -1.2f) == +1);
|
assertEquals(Float.compare(Float.MAX_VALUE, -1.2f), +1);
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, -Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(Float.MAX_VALUE, -Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(Float.MAX_VALUE, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(1.2f, Float.NaN) == -1);
|
assertEquals(Float.compare(1.2f, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(1.2f, Float.POSITIVE_INFINITY) == -1);
|
assertEquals(Float.compare(1.2f, Float.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Float.compare(1.2f, Float.MAX_VALUE) == -1);
|
assertEquals(Float.compare(1.2f, Float.MAX_VALUE), -1);
|
||||||
assertTrue(Float.compare(1.2f, 1.2f) == 0);
|
assertEquals(0, Float.compare(1.2f, 1.2f));
|
||||||
assertTrue(Float.compare(1.2f, 0.0f) == +1);
|
assertEquals(Float.compare(1.2f, 0.0f), +1);
|
||||||
assertTrue(Float.compare(1.2f, -0.0f) == +1);
|
assertEquals(Float.compare(1.2f, -0.0f), +1);
|
||||||
assertTrue(Float.compare(1.2f, -1.2f) == +1);
|
assertEquals(Float.compare(1.2f, -1.2f), +1);
|
||||||
assertTrue(Float.compare(1.2f, -Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(1.2f, -Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(1.2f, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(1.2f, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(0.0f, Float.NaN) == -1);
|
assertEquals(Float.compare(0.0f, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(0.0f, Float.POSITIVE_INFINITY) == -1);
|
assertEquals(Float.compare(0.0f, Float.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Float.compare(0.0f, Float.MAX_VALUE) == -1);
|
assertEquals(Float.compare(0.0f, Float.MAX_VALUE), -1);
|
||||||
assertTrue(Float.compare(0.0f, 1.2f) == -1);
|
assertEquals(Float.compare(0.0f, 1.2f), -1);
|
||||||
assertTrue(Float.compare(0.0f, 0.0f) == 0);
|
assertEquals(0, Float.compare(0.0f, 0.0f));
|
||||||
assertTrue(Float.compare(0.0f, -0.0f) == +1);
|
assertEquals(Float.compare(0.0f, -0.0f), +1);
|
||||||
assertTrue(Float.compare(0.0f, -1.2f) == +1);
|
assertEquals(Float.compare(0.0f, -1.2f), +1);
|
||||||
assertTrue(Float.compare(0.0f, -Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(0.0f, -Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(0.0f, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(0.0f, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(-0.0f, Float.NaN) == -1);
|
assertEquals(Float.compare(-0.0f, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(-0.0f, Float.POSITIVE_INFINITY) == -1);
|
assertEquals(Float.compare(-0.0f, Float.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Float.compare(-0.0f, Float.MAX_VALUE) == -1);
|
assertEquals(Float.compare(-0.0f, Float.MAX_VALUE), -1);
|
||||||
assertTrue(Float.compare(-0.0f, 1.2f) == -1);
|
assertEquals(Float.compare(-0.0f, 1.2f), -1);
|
||||||
assertTrue(Float.compare(-0.0f, 0.0f) == -1);
|
assertEquals(Float.compare(-0.0f, 0.0f), -1);
|
||||||
assertTrue(Float.compare(-0.0f, -0.0f) == 0);
|
assertEquals(0, Float.compare(-0.0f, -0.0f));
|
||||||
assertTrue(Float.compare(-0.0f, -1.2f) == +1);
|
assertEquals(Float.compare(-0.0f, -1.2f), +1);
|
||||||
assertTrue(Float.compare(-0.0f, -Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(-0.0f, -Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(-0.0f, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(-0.0f, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(-1.2f, Float.NaN) == -1);
|
assertEquals(Float.compare(-1.2f, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(-1.2f, Float.POSITIVE_INFINITY) == -1);
|
assertEquals(Float.compare(-1.2f, Float.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Float.compare(-1.2f, Float.MAX_VALUE) == -1);
|
assertEquals(Float.compare(-1.2f, Float.MAX_VALUE), -1);
|
||||||
assertTrue(Float.compare(-1.2f, 1.2f) == -1);
|
assertEquals(Float.compare(-1.2f, 1.2f), -1);
|
||||||
assertTrue(Float.compare(-1.2f, 0.0f) == -1);
|
assertEquals(Float.compare(-1.2f, 0.0f), -1);
|
||||||
assertTrue(Float.compare(-1.2f, -0.0f) == -1);
|
assertEquals(Float.compare(-1.2f, -0.0f), -1);
|
||||||
assertTrue(Float.compare(-1.2f, -1.2f) == 0);
|
assertEquals(0, Float.compare(-1.2f, -1.2f));
|
||||||
assertTrue(Float.compare(-1.2f, -Float.MAX_VALUE) == +1);
|
assertEquals(Float.compare(-1.2f, -Float.MAX_VALUE), +1);
|
||||||
assertTrue(Float.compare(-1.2f, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(-1.2f, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, Float.NaN) == -1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, Float.POSITIVE_INFINITY) == -1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, Float.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, Float.MAX_VALUE) == -1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, Float.MAX_VALUE), -1);
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, 1.2f) == -1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, 1.2f), -1);
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, 0.0f) == -1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, 0.0f), -1);
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, -0.0f) == -1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, -0.0f), -1);
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, -1.2f) == -1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, -1.2f), -1);
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, -Float.MAX_VALUE) == 0);
|
assertEquals(0, Float.compare(-Float.MAX_VALUE, -Float.MAX_VALUE));
|
||||||
assertTrue(Float.compare(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY) == +1);
|
assertEquals(Float.compare(-Float.MAX_VALUE, Float.NEGATIVE_INFINITY), +1);
|
||||||
|
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.NaN) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, Float.NaN), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, Float.POSITIVE_INFINITY), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.MAX_VALUE) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, Float.MAX_VALUE), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, 1.2f) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, 1.2f), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, 0.0f) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, 0.0f), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -0.0f) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, -0.0f), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -1.2f) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, -1.2f), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE) == -1);
|
assertEquals(Float.compare(Float.NEGATIVE_INFINITY, -Float.MAX_VALUE), -1);
|
||||||
assertTrue(Float.compare(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY) == 0);
|
assertEquals(0, Float.compare(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -1558,23 +1511,23 @@ public void testConstants() {
|
||||||
assertTrue(NumberUtils.FLOAT_ONE instanceof Float);
|
assertTrue(NumberUtils.FLOAT_ONE instanceof Float);
|
||||||
assertTrue(NumberUtils.FLOAT_MINUS_ONE instanceof Float);
|
assertTrue(NumberUtils.FLOAT_MINUS_ONE instanceof Float);
|
||||||
|
|
||||||
assertTrue(NumberUtils.LONG_ZERO.longValue() == 0);
|
assertEquals(0, NumberUtils.LONG_ZERO.longValue());
|
||||||
assertTrue(NumberUtils.LONG_ONE.longValue() == 1);
|
assertEquals(1, NumberUtils.LONG_ONE.longValue());
|
||||||
assertTrue(NumberUtils.LONG_MINUS_ONE.longValue() == -1);
|
assertEquals(NumberUtils.LONG_MINUS_ONE.longValue(), -1);
|
||||||
assertTrue(NumberUtils.INTEGER_ZERO.intValue() == 0);
|
assertEquals(0, NumberUtils.INTEGER_ZERO.intValue());
|
||||||
assertTrue(NumberUtils.INTEGER_ONE.intValue() == 1);
|
assertEquals(1, NumberUtils.INTEGER_ONE.intValue());
|
||||||
assertTrue(NumberUtils.INTEGER_MINUS_ONE.intValue() == -1);
|
assertEquals(NumberUtils.INTEGER_MINUS_ONE.intValue(), -1);
|
||||||
assertTrue(NumberUtils.SHORT_ZERO.shortValue() == 0);
|
assertEquals(0, NumberUtils.SHORT_ZERO.shortValue());
|
||||||
assertTrue(NumberUtils.SHORT_ONE.shortValue() == 1);
|
assertEquals(1, NumberUtils.SHORT_ONE.shortValue());
|
||||||
assertTrue(NumberUtils.SHORT_MINUS_ONE.shortValue() == -1);
|
assertEquals(NumberUtils.SHORT_MINUS_ONE.shortValue(), -1);
|
||||||
assertTrue(NumberUtils.BYTE_ZERO.byteValue() == 0);
|
assertEquals(0, NumberUtils.BYTE_ZERO.byteValue());
|
||||||
assertTrue(NumberUtils.BYTE_ONE.byteValue() == 1);
|
assertEquals(1, NumberUtils.BYTE_ONE.byteValue());
|
||||||
assertTrue(NumberUtils.BYTE_MINUS_ONE.byteValue() == -1);
|
assertEquals(NumberUtils.BYTE_MINUS_ONE.byteValue(), -1);
|
||||||
assertTrue(NumberUtils.DOUBLE_ZERO.doubleValue() == 0.0d);
|
assertTrue(0.0d == NumberUtils.DOUBLE_ZERO.doubleValue());
|
||||||
assertTrue(NumberUtils.DOUBLE_ONE.doubleValue() == 1.0d);
|
assertTrue(1.0d == NumberUtils.DOUBLE_ONE.doubleValue());
|
||||||
assertTrue(NumberUtils.DOUBLE_MINUS_ONE.doubleValue() == -1.0d);
|
assertTrue(NumberUtils.DOUBLE_MINUS_ONE.doubleValue() == -1.0d);
|
||||||
assertTrue(NumberUtils.FLOAT_ZERO.floatValue() == 0.0f);
|
assertTrue(0.0f == NumberUtils.FLOAT_ZERO.floatValue());
|
||||||
assertTrue(NumberUtils.FLOAT_ONE.floatValue() == 1.0f);
|
assertTrue(1.0f == NumberUtils.FLOAT_ONE.floatValue());
|
||||||
assertTrue(NumberUtils.FLOAT_MINUS_ONE.floatValue() == -1.0f);
|
assertTrue(NumberUtils.FLOAT_MINUS_ONE.floatValue() == -1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1610,28 +1563,28 @@ public void testLang381() {
|
||||||
@Test
|
@Test
|
||||||
public void compareInt() {
|
public void compareInt() {
|
||||||
assertTrue(NumberUtils.compare(-3, 0) < 0);
|
assertTrue(NumberUtils.compare(-3, 0) < 0);
|
||||||
assertTrue(NumberUtils.compare(113, 113)==0);
|
assertEquals(0, NumberUtils.compare(113, 113));
|
||||||
assertTrue(NumberUtils.compare(213, 32) > 0);
|
assertTrue(NumberUtils.compare(213, 32) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void compareLong() {
|
public void compareLong() {
|
||||||
assertTrue(NumberUtils.compare(-3L, 0L) < 0);
|
assertTrue(NumberUtils.compare(-3L, 0L) < 0);
|
||||||
assertTrue(NumberUtils.compare(113L, 113L)==0);
|
assertEquals(0, NumberUtils.compare(113L, 113L));
|
||||||
assertTrue(NumberUtils.compare(213L, 32L) > 0);
|
assertTrue(NumberUtils.compare(213L, 32L) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void compareShort() {
|
public void compareShort() {
|
||||||
assertTrue(NumberUtils.compare((short)-3, (short)0) < 0);
|
assertTrue(NumberUtils.compare((short)-3, (short)0) < 0);
|
||||||
assertTrue(NumberUtils.compare((short)113, (short)113)==0);
|
assertEquals(0, NumberUtils.compare((short) 113, (short) 113));
|
||||||
assertTrue(NumberUtils.compare((short)213, (short)32) > 0);
|
assertTrue(NumberUtils.compare((short)213, (short)32) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void compareByte() {
|
public void compareByte() {
|
||||||
assertTrue(NumberUtils.compare((byte)-3, (byte)0) < 0);
|
assertTrue(NumberUtils.compare((byte)-3, (byte)0) < 0);
|
||||||
assertTrue(NumberUtils.compare((byte)113, (byte)113)==0);
|
assertEquals(0, NumberUtils.compare((byte) 113, (byte) 113));
|
||||||
assertTrue(NumberUtils.compare((byte)123, (byte)32) > 0);
|
assertTrue(NumberUtils.compare((byte)123, (byte)32) > 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -73,16 +74,16 @@ public void testEquals() {
|
||||||
final MutableBoolean mutBoolB = new MutableBoolean(false);
|
final MutableBoolean mutBoolB = new MutableBoolean(false);
|
||||||
final MutableBoolean mutBoolC = new MutableBoolean(true);
|
final MutableBoolean mutBoolC = new MutableBoolean(true);
|
||||||
|
|
||||||
assertTrue(mutBoolA.equals(mutBoolA));
|
assertEquals(mutBoolA, mutBoolA);
|
||||||
assertTrue(mutBoolA.equals(mutBoolB));
|
assertEquals(mutBoolA, mutBoolB);
|
||||||
assertTrue(mutBoolB.equals(mutBoolA));
|
assertEquals(mutBoolB, mutBoolA);
|
||||||
assertTrue(mutBoolB.equals(mutBoolB));
|
assertEquals(mutBoolB, mutBoolB);
|
||||||
assertFalse(mutBoolA.equals(mutBoolC));
|
assertNotEquals(mutBoolA, mutBoolC);
|
||||||
assertFalse(mutBoolB.equals(mutBoolC));
|
assertNotEquals(mutBoolB, mutBoolC);
|
||||||
assertTrue(mutBoolC.equals(mutBoolC));
|
assertEquals(mutBoolC, mutBoolC);
|
||||||
assertFalse(mutBoolA.equals(null));
|
assertNotEquals(null, mutBoolA);
|
||||||
assertFalse(mutBoolA.equals(Boolean.FALSE));
|
assertNotEquals(mutBoolA, Boolean.FALSE);
|
||||||
assertFalse(mutBoolA.equals("false"));
|
assertNotEquals("false", mutBoolA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -80,16 +81,16 @@ public void testEquals() {
|
||||||
final MutableByte mutNumB = new MutableByte((byte) 0);
|
final MutableByte mutNumB = new MutableByte((byte) 0);
|
||||||
final MutableByte mutNumC = new MutableByte((byte) 1);
|
final MutableByte mutNumC = new MutableByte((byte) 1);
|
||||||
|
|
||||||
assertTrue(mutNumA.equals(mutNumA));
|
assertEquals(mutNumA, mutNumA);
|
||||||
assertTrue(mutNumA.equals(mutNumB));
|
assertEquals(mutNumA, mutNumB);
|
||||||
assertTrue(mutNumB.equals(mutNumA));
|
assertEquals(mutNumB, mutNumA);
|
||||||
assertTrue(mutNumB.equals(mutNumB));
|
assertEquals(mutNumB, mutNumB);
|
||||||
assertFalse(mutNumA.equals(mutNumC));
|
assertNotEquals(mutNumA, mutNumC);
|
||||||
assertFalse(mutNumB.equals(mutNumC));
|
assertNotEquals(mutNumB, mutNumC);
|
||||||
assertTrue(mutNumC.equals(mutNumC));
|
assertEquals(mutNumC, mutNumC);
|
||||||
assertFalse(mutNumA.equals(null));
|
assertNotEquals(null, mutNumA);
|
||||||
assertFalse(mutNumA.equals(Byte.valueOf((byte) 0)));
|
assertNotEquals(mutNumA, Byte.valueOf((byte) 0));
|
||||||
assertFalse(mutNumA.equals("0"));
|
assertNotEquals("0", mutNumA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -98,10 +99,10 @@ public void testHashCode() {
|
||||||
final MutableByte mutNumB = new MutableByte((byte) 0);
|
final MutableByte mutNumB = new MutableByte((byte) 0);
|
||||||
final MutableByte mutNumC = new MutableByte((byte) 1);
|
final MutableByte mutNumC = new MutableByte((byte) 1);
|
||||||
|
|
||||||
assertTrue(mutNumA.hashCode() == mutNumA.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumA.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == mutNumB.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumB.hashCode());
|
||||||
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == Byte.valueOf((byte) 0).hashCode());
|
assertEquals(mutNumA.hashCode(), Byte.valueOf((byte) 0).hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -92,16 +93,16 @@ public void testEquals() {
|
||||||
final MutableDouble mutNumB = new MutableDouble(0d);
|
final MutableDouble mutNumB = new MutableDouble(0d);
|
||||||
final MutableDouble mutNumC = new MutableDouble(1d);
|
final MutableDouble mutNumC = new MutableDouble(1d);
|
||||||
|
|
||||||
assertTrue(mutNumA.equals(mutNumA));
|
assertEquals(mutNumA, mutNumA);
|
||||||
assertTrue(mutNumA.equals(mutNumB));
|
assertEquals(mutNumA, mutNumB);
|
||||||
assertTrue(mutNumB.equals(mutNumA));
|
assertEquals(mutNumB, mutNumA);
|
||||||
assertTrue(mutNumB.equals(mutNumB));
|
assertEquals(mutNumB, mutNumB);
|
||||||
assertFalse(mutNumA.equals(mutNumC));
|
assertNotEquals(mutNumA, mutNumC);
|
||||||
assertFalse(mutNumB.equals(mutNumC));
|
assertNotEquals(mutNumB, mutNumC);
|
||||||
assertTrue(mutNumC.equals(mutNumC));
|
assertEquals(mutNumC, mutNumC);
|
||||||
assertFalse(mutNumA.equals(null));
|
assertNotEquals(null, mutNumA);
|
||||||
assertFalse(mutNumA.equals(Double.valueOf(0d)));
|
assertNotEquals(mutNumA, Double.valueOf(0d));
|
||||||
assertFalse(mutNumA.equals("0"));
|
assertNotEquals("0", mutNumA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -110,10 +111,10 @@ public void testHashCode() {
|
||||||
final MutableDouble mutNumB = new MutableDouble(0d);
|
final MutableDouble mutNumB = new MutableDouble(0d);
|
||||||
final MutableDouble mutNumC = new MutableDouble(1d);
|
final MutableDouble mutNumC = new MutableDouble(1d);
|
||||||
|
|
||||||
assertTrue(mutNumA.hashCode() == mutNumA.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumA.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == mutNumB.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumB.hashCode());
|
||||||
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == Double.valueOf(0d).hashCode());
|
assertEquals(mutNumA.hashCode(), Double.valueOf(0d).hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -92,16 +93,16 @@ public void testEquals() {
|
||||||
final MutableFloat mutNumB = new MutableFloat(0f);
|
final MutableFloat mutNumB = new MutableFloat(0f);
|
||||||
final MutableFloat mutNumC = new MutableFloat(1f);
|
final MutableFloat mutNumC = new MutableFloat(1f);
|
||||||
|
|
||||||
assertTrue(mutNumA.equals(mutNumA));
|
assertEquals(mutNumA, mutNumA);
|
||||||
assertTrue(mutNumA.equals(mutNumB));
|
assertEquals(mutNumA, mutNumB);
|
||||||
assertTrue(mutNumB.equals(mutNumA));
|
assertEquals(mutNumB, mutNumA);
|
||||||
assertTrue(mutNumB.equals(mutNumB));
|
assertEquals(mutNumB, mutNumB);
|
||||||
assertFalse(mutNumA.equals(mutNumC));
|
assertNotEquals(mutNumA, mutNumC);
|
||||||
assertFalse(mutNumB.equals(mutNumC));
|
assertNotEquals(mutNumB, mutNumC);
|
||||||
assertTrue(mutNumC.equals(mutNumC));
|
assertEquals(mutNumC, mutNumC);
|
||||||
assertFalse(mutNumA.equals(null));
|
assertNotEquals(null, mutNumA);
|
||||||
assertFalse(mutNumA.equals(Float.valueOf(0f)));
|
assertNotEquals(mutNumA, Float.valueOf(0f));
|
||||||
assertFalse(mutNumA.equals("0"));
|
assertNotEquals("0", mutNumA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -110,10 +111,10 @@ public void testHashCode() {
|
||||||
final MutableFloat mutNumB = new MutableFloat(0f);
|
final MutableFloat mutNumB = new MutableFloat(0f);
|
||||||
final MutableFloat mutNumC = new MutableFloat(1f);
|
final MutableFloat mutNumC = new MutableFloat(1f);
|
||||||
|
|
||||||
assertTrue(mutNumA.hashCode() == mutNumA.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumA.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == mutNumB.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumB.hashCode());
|
||||||
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == Float.valueOf(0f).hashCode());
|
assertEquals(mutNumA.hashCode(), Float.valueOf(0f).hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -87,16 +88,16 @@ public void testEquals() {
|
||||||
* @param numC must not equal numA; must not equal numC.
|
* @param numC must not equal numA; must not equal numC.
|
||||||
*/
|
*/
|
||||||
void testEquals(final Number numA, final Number numB, final Number numC) {
|
void testEquals(final Number numA, final Number numB, final Number numC) {
|
||||||
assertTrue(numA.equals(numA));
|
assertEquals(numA, numA);
|
||||||
assertTrue(numA.equals(numB));
|
assertEquals(numA, numB);
|
||||||
assertTrue(numB.equals(numA));
|
assertEquals(numB, numA);
|
||||||
assertTrue(numB.equals(numB));
|
assertEquals(numB, numB);
|
||||||
assertFalse(numA.equals(numC));
|
assertNotEquals(numA, numC);
|
||||||
assertFalse(numB.equals(numC));
|
assertNotEquals(numB, numC);
|
||||||
assertTrue(numC.equals(numC));
|
assertEquals(numC, numC);
|
||||||
assertFalse(numA.equals(null));
|
assertNotEquals(null, numA);
|
||||||
assertFalse(numA.equals(Integer.valueOf(0)));
|
assertNotEquals(numA, Integer.valueOf(0));
|
||||||
assertFalse(numA.equals("0"));
|
assertNotEquals("0", numA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -105,10 +106,10 @@ public void testHashCode() {
|
||||||
final MutableInt mutNumB = new MutableInt(0);
|
final MutableInt mutNumB = new MutableInt(0);
|
||||||
final MutableInt mutNumC = new MutableInt(1);
|
final MutableInt mutNumC = new MutableInt(1);
|
||||||
|
|
||||||
assertTrue(mutNumA.hashCode() == mutNumA.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumA.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == mutNumB.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumB.hashCode());
|
||||||
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == Integer.valueOf(0).hashCode());
|
assertEquals(mutNumA.hashCode(), Integer.valueOf(0).hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -80,16 +81,16 @@ public void testEquals() {
|
||||||
final MutableLong mutNumB = new MutableLong(0);
|
final MutableLong mutNumB = new MutableLong(0);
|
||||||
final MutableLong mutNumC = new MutableLong(1);
|
final MutableLong mutNumC = new MutableLong(1);
|
||||||
|
|
||||||
assertTrue(mutNumA.equals(mutNumA));
|
assertEquals(mutNumA, mutNumA);
|
||||||
assertTrue(mutNumA.equals(mutNumB));
|
assertEquals(mutNumA, mutNumB);
|
||||||
assertTrue(mutNumB.equals(mutNumA));
|
assertEquals(mutNumB, mutNumA);
|
||||||
assertTrue(mutNumB.equals(mutNumB));
|
assertEquals(mutNumB, mutNumB);
|
||||||
assertFalse(mutNumA.equals(mutNumC));
|
assertNotEquals(mutNumA, mutNumC);
|
||||||
assertFalse(mutNumB.equals(mutNumC));
|
assertNotEquals(mutNumB, mutNumC);
|
||||||
assertTrue(mutNumC.equals(mutNumC));
|
assertEquals(mutNumC, mutNumC);
|
||||||
assertFalse(mutNumA.equals(null));
|
assertNotEquals(null, mutNumA);
|
||||||
assertFalse(mutNumA.equals(Long.valueOf(0)));
|
assertNotEquals(mutNumA, Long.valueOf(0));
|
||||||
assertFalse(mutNumA.equals("0"));
|
assertNotEquals("0", mutNumA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -98,10 +99,10 @@ public void testHashCode() {
|
||||||
final MutableLong mutNumB = new MutableLong(0);
|
final MutableLong mutNumB = new MutableLong(0);
|
||||||
final MutableLong mutNumC = new MutableLong(1);
|
final MutableLong mutNumC = new MutableLong(1);
|
||||||
|
|
||||||
assertTrue(mutNumA.hashCode() == mutNumA.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumA.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == mutNumB.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumB.hashCode());
|
||||||
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == Long.valueOf(0).hashCode());
|
assertEquals(mutNumA.hashCode(), Long.valueOf(0).hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -71,16 +72,16 @@ public void testEquals() {
|
||||||
final MutableShort mutNumB = new MutableShort((short) 0);
|
final MutableShort mutNumB = new MutableShort((short) 0);
|
||||||
final MutableShort mutNumC = new MutableShort((short) 1);
|
final MutableShort mutNumC = new MutableShort((short) 1);
|
||||||
|
|
||||||
assertTrue(mutNumA.equals(mutNumA));
|
assertEquals(mutNumA, mutNumA);
|
||||||
assertTrue(mutNumA.equals(mutNumB));
|
assertEquals(mutNumA, mutNumB);
|
||||||
assertTrue(mutNumB.equals(mutNumA));
|
assertEquals(mutNumB, mutNumA);
|
||||||
assertTrue(mutNumB.equals(mutNumB));
|
assertEquals(mutNumB, mutNumB);
|
||||||
assertFalse(mutNumA.equals(mutNumC));
|
assertNotEquals(mutNumA, mutNumC);
|
||||||
assertFalse(mutNumB.equals(mutNumC));
|
assertNotEquals(mutNumB, mutNumC);
|
||||||
assertTrue(mutNumC.equals(mutNumC));
|
assertEquals(mutNumC, mutNumC);
|
||||||
assertFalse(mutNumA.equals(null));
|
assertNotEquals(null, mutNumA);
|
||||||
assertFalse(mutNumA.equals(Short.valueOf((short) 0)));
|
assertNotEquals(mutNumA, Short.valueOf((short) 0));
|
||||||
assertFalse(mutNumA.equals("0"));
|
assertNotEquals("0", mutNumA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -89,10 +90,10 @@ public void testHashCode() {
|
||||||
final MutableShort mutNumB = new MutableShort((short) 0);
|
final MutableShort mutNumB = new MutableShort((short) 0);
|
||||||
final MutableShort mutNumC = new MutableShort((short) 1);
|
final MutableShort mutNumC = new MutableShort((short) 1);
|
||||||
|
|
||||||
assertTrue(mutNumA.hashCode() == mutNumA.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumA.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == mutNumB.hashCode());
|
assertEquals(mutNumA.hashCode(), mutNumB.hashCode());
|
||||||
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
assertFalse(mutNumA.hashCode() == mutNumC.hashCode());
|
||||||
assertTrue(mutNumA.hashCode() == Short.valueOf((short) 0).hashCode());
|
assertEquals(mutNumA.hashCode(), Short.valueOf((short) 0).hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.FieldPosition;
|
import java.text.FieldPosition;
|
||||||
|
@ -301,33 +301,33 @@ public void testEqualsHashcode() {
|
||||||
ExtendedMessageFormat other = null;
|
ExtendedMessageFormat other = null;
|
||||||
|
|
||||||
// Same object
|
// Same object
|
||||||
assertTrue(emf.equals(emf), "same, equals()");
|
assertEquals(emf, emf, "same, equals()");
|
||||||
assertTrue(emf.hashCode() == emf.hashCode(), "same, hashcode()");
|
assertEquals(emf.hashCode(), emf.hashCode(), "same, hashcode()");
|
||||||
|
|
||||||
// Equal Object
|
// Equal Object
|
||||||
other = new ExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
|
other = new ExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
|
||||||
assertTrue(emf.equals(other), "equal, equals()");
|
assertEquals(emf, other, "equal, equals()");
|
||||||
assertTrue(emf.hashCode() == other.hashCode(), "equal, hashcode()");
|
assertEquals(emf.hashCode(), other.hashCode(), "equal, hashcode()");
|
||||||
|
|
||||||
// Different Class
|
// Different Class
|
||||||
other = new OtherExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
|
other = new OtherExtendedMessageFormat(pattern, Locale.US, fmtRegistry);
|
||||||
assertFalse(emf.equals(other), "class, equals()");
|
assertNotEquals(emf, other, "class, equals()");
|
||||||
assertTrue(emf.hashCode() == other.hashCode(), "class, hashcode()"); // same hashcode
|
assertEquals(emf.hashCode(), other.hashCode(), "class, hashcode()"); // same hashcode
|
||||||
|
|
||||||
// Different pattern
|
// Different pattern
|
||||||
other = new ExtendedMessageFormat("X" + pattern, Locale.US, fmtRegistry);
|
other = new ExtendedMessageFormat("X" + pattern, Locale.US, fmtRegistry);
|
||||||
assertFalse(emf.equals(other), "pattern, equals()");
|
assertNotEquals(emf, other, "pattern, equals()");
|
||||||
assertFalse(emf.hashCode() == other.hashCode(), "pattern, hashcode()");
|
assertFalse(emf.hashCode() == other.hashCode(), "pattern, hashcode()");
|
||||||
|
|
||||||
// Different registry
|
// Different registry
|
||||||
other = new ExtendedMessageFormat(pattern, Locale.US, otherRegitry);
|
other = new ExtendedMessageFormat(pattern, Locale.US, otherRegitry);
|
||||||
assertFalse(emf.equals(other), "registry, equals()");
|
assertNotEquals(emf, other, "registry, equals()");
|
||||||
assertFalse(emf.hashCode() == other.hashCode(), "registry, hashcode()");
|
assertFalse(emf.hashCode() == other.hashCode(), "registry, hashcode()");
|
||||||
|
|
||||||
// Different Locale
|
// Different Locale
|
||||||
other = new ExtendedMessageFormat(pattern, Locale.FRANCE, fmtRegistry);
|
other = new ExtendedMessageFormat(pattern, Locale.FRANCE, fmtRegistry);
|
||||||
assertFalse(emf.equals(other), "locale, equals()");
|
assertNotEquals(emf, other, "locale, equals()");
|
||||||
assertTrue(emf.hashCode() == other.hashCode(), "locale, hashcode()"); // same hashcode
|
assertEquals(emf.hashCode(), other.hashCode(), "locale, hashcode()"); // same hashcode
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
@ -241,7 +242,7 @@ public void testCapacityAndLength() {
|
||||||
assertTrue(sb.capacity() >= 32);
|
assertTrue(sb.capacity() >= 32);
|
||||||
assertEquals(3, sb.length());
|
assertEquals(3, sb.length());
|
||||||
assertEquals(3, sb.size());
|
assertEquals(3, sb.size());
|
||||||
assertTrue(sb.isEmpty() == false);
|
assertFalse(sb.isEmpty());
|
||||||
|
|
||||||
sb.clear();
|
sb.clear();
|
||||||
assertTrue(sb.capacity() >= 32);
|
assertTrue(sb.capacity() >= 32);
|
||||||
|
@ -253,19 +254,19 @@ public void testCapacityAndLength() {
|
||||||
assertTrue(sb.capacity() > 32);
|
assertTrue(sb.capacity() > 32);
|
||||||
assertEquals(33, sb.length());
|
assertEquals(33, sb.length());
|
||||||
assertEquals(33, sb.size());
|
assertEquals(33, sb.size());
|
||||||
assertTrue(sb.isEmpty() == false);
|
assertFalse(sb.isEmpty());
|
||||||
|
|
||||||
sb.ensureCapacity(16);
|
sb.ensureCapacity(16);
|
||||||
assertTrue(sb.capacity() > 16);
|
assertTrue(sb.capacity() > 16);
|
||||||
assertEquals(33, sb.length());
|
assertEquals(33, sb.length());
|
||||||
assertEquals(33, sb.size());
|
assertEquals(33, sb.size());
|
||||||
assertTrue(sb.isEmpty() == false);
|
assertFalse(sb.isEmpty());
|
||||||
|
|
||||||
sb.minimizeCapacity();
|
sb.minimizeCapacity();
|
||||||
assertEquals(33, sb.capacity());
|
assertEquals(33, sb.capacity());
|
||||||
assertEquals(33, sb.length());
|
assertEquals(33, sb.length());
|
||||||
assertEquals(33, sb.size());
|
assertEquals(33, sb.size());
|
||||||
assertTrue(sb.isEmpty() == false);
|
assertFalse(sb.isEmpty());
|
||||||
|
|
||||||
assertThrows(
|
assertThrows(
|
||||||
IndexOutOfBoundsException.class,
|
IndexOutOfBoundsException.class,
|
||||||
|
@ -276,21 +277,21 @@ public void testCapacityAndLength() {
|
||||||
assertEquals(33, sb.capacity());
|
assertEquals(33, sb.capacity());
|
||||||
assertEquals(33, sb.length());
|
assertEquals(33, sb.length());
|
||||||
assertEquals(33, sb.size());
|
assertEquals(33, sb.size());
|
||||||
assertTrue(sb.isEmpty() == false);
|
assertFalse(sb.isEmpty());
|
||||||
|
|
||||||
sb.setLength(16);
|
sb.setLength(16);
|
||||||
assertTrue(sb.capacity() >= 16);
|
assertTrue(sb.capacity() >= 16);
|
||||||
assertEquals(16, sb.length());
|
assertEquals(16, sb.length());
|
||||||
assertEquals(16, sb.size());
|
assertEquals(16, sb.size());
|
||||||
assertEquals("1234567890123456", sb.toString());
|
assertEquals("1234567890123456", sb.toString());
|
||||||
assertTrue(sb.isEmpty() == false);
|
assertFalse(sb.isEmpty());
|
||||||
|
|
||||||
sb.setLength(32);
|
sb.setLength(32);
|
||||||
assertTrue(sb.capacity() >= 32);
|
assertTrue(sb.capacity() >= 32);
|
||||||
assertEquals(32, sb.length());
|
assertEquals(32, sb.length());
|
||||||
assertEquals(32, sb.size());
|
assertEquals(32, sb.size());
|
||||||
assertEquals("1234567890123456\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", sb.toString());
|
assertEquals("1234567890123456\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", sb.toString());
|
||||||
assertTrue(sb.isEmpty() == false);
|
assertFalse(sb.isEmpty());
|
||||||
|
|
||||||
sb.setLength(0);
|
sb.setLength(0);
|
||||||
assertTrue(sb.capacity() >= 32);
|
assertTrue(sb.capacity() >= 32);
|
||||||
|
@ -1721,22 +1722,22 @@ public void testEquals() {
|
||||||
assertTrue(sb1.equals(sb2));
|
assertTrue(sb1.equals(sb2));
|
||||||
assertTrue(sb1.equals(sb1));
|
assertTrue(sb1.equals(sb1));
|
||||||
assertTrue(sb2.equals(sb2));
|
assertTrue(sb2.equals(sb2));
|
||||||
assertTrue(sb1.equals((Object) sb2));
|
assertEquals(sb1, (Object) sb2);
|
||||||
|
|
||||||
sb1.append("abc");
|
sb1.append("abc");
|
||||||
assertFalse(sb1.equals(sb2));
|
assertFalse(sb1.equals(sb2));
|
||||||
assertFalse(sb1.equals((Object) sb2));
|
assertNotEquals(sb1, (Object) sb2);
|
||||||
|
|
||||||
sb2.append("ABC");
|
sb2.append("ABC");
|
||||||
assertFalse(sb1.equals(sb2));
|
assertFalse(sb1.equals(sb2));
|
||||||
assertFalse(sb1.equals((Object) sb2));
|
assertNotEquals(sb1, (Object) sb2);
|
||||||
|
|
||||||
sb2.clear().append("abc");
|
sb2.clear().append("abc");
|
||||||
assertTrue(sb1.equals(sb2));
|
assertTrue(sb1.equals(sb2));
|
||||||
assertTrue(sb1.equals((Object) sb2));
|
assertEquals(sb1, (Object) sb2);
|
||||||
|
|
||||||
assertFalse(sb1.equals(Integer.valueOf(1)));
|
assertNotEquals(sb1, Integer.valueOf(1));
|
||||||
assertFalse(sb1.equals("abc"));
|
assertNotEquals("abc", sb1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
@ -43,8 +44,8 @@ public class StrTokenizerTest {
|
||||||
private static final String TSV_SIMPLE_FIXTURE = "A\tb\tc";
|
private static final String TSV_SIMPLE_FIXTURE = "A\tb\tc";
|
||||||
|
|
||||||
private void checkClone(final StrTokenizer tokenizer) {
|
private void checkClone(final StrTokenizer tokenizer) {
|
||||||
assertFalse(StrTokenizer.getCSVInstance() == tokenizer);
|
assertNotSame(StrTokenizer.getCSVInstance(), tokenizer);
|
||||||
assertFalse(StrTokenizer.getTSVInstance() == tokenizer);
|
assertNotSame(StrTokenizer.getTSVInstance(), tokenizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------
|
// -----------------------------------------------------------------------
|
||||||
|
@ -182,11 +183,9 @@ public void test6() {
|
||||||
|
|
||||||
assertEquals(expected.length, tokens.length, ArrayUtils.toString(tokens));
|
assertEquals(expected.length, tokens.length, ArrayUtils.toString(tokens));
|
||||||
|
|
||||||
assertTrue(nextCount == expected.length,
|
assertEquals(nextCount, expected.length, "could not cycle through entire token list" + " using the 'hasNext' and 'next' methods");
|
||||||
"could not cycle through entire token list" + " using the 'hasNext' and 'next' methods");
|
|
||||||
|
|
||||||
assertTrue(prevCount == expected.length,
|
assertEquals(prevCount, expected.length, "could not cycle through entire token list" + " using the 'hasPrevious' and 'previous' methods");
|
||||||
"could not cycle through entire token list" + " using the 'hasPrevious' and 'previous' methods");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
@ -667,7 +667,7 @@ protected void baseTruncateTest(final Date truncatedDate, final Date lastTruncat
|
||||||
//Date-comparison
|
//Date-comparison
|
||||||
assertEquals(truncatedDate, DateUtils.truncate(truncatedDate, calendarField), "Truncating "+ fdf.format(truncatedDate) +" as Date with CalendarField-value "+ calendarField +" must return itself");
|
assertEquals(truncatedDate, DateUtils.truncate(truncatedDate, calendarField), "Truncating "+ fdf.format(truncatedDate) +" as Date with CalendarField-value "+ calendarField +" must return itself");
|
||||||
assertEquals(truncatedDate, DateUtils.truncate(lastTruncateDate, calendarField));
|
assertEquals(truncatedDate, DateUtils.truncate(lastTruncateDate, calendarField));
|
||||||
assertFalse(truncatedDate.equals(DateUtils.truncate(nextTruncateDate, calendarField)), fdf.format(lastTruncateDate) +" is not an extreme when truncating as Date with CalendarField-value "+ calendarField);
|
assertNotEquals(truncatedDate, DateUtils.truncate(nextTruncateDate, calendarField), fdf.format(lastTruncateDate) + " is not an extreme when truncating as Date with CalendarField-value " + calendarField);
|
||||||
|
|
||||||
//Calendar-initiations
|
//Calendar-initiations
|
||||||
Calendar truncatedCalendar, lastTruncateCalendar, nextTruncateCalendar;
|
Calendar truncatedCalendar, lastTruncateCalendar, nextTruncateCalendar;
|
||||||
|
@ -681,15 +681,15 @@ protected void baseTruncateTest(final Date truncatedDate, final Date lastTruncat
|
||||||
//Calendar-comparison
|
//Calendar-comparison
|
||||||
assertEquals(truncatedCalendar, DateUtils.truncate(truncatedCalendar, calendarField), "Truncating "+ fdf.format(truncatedCalendar) +" as Calendar with CalendarField-value "+ calendarField +" must return itself");
|
assertEquals(truncatedCalendar, DateUtils.truncate(truncatedCalendar, calendarField), "Truncating "+ fdf.format(truncatedCalendar) +" as Calendar with CalendarField-value "+ calendarField +" must return itself");
|
||||||
assertEquals(truncatedCalendar, DateUtils.truncate(lastTruncateCalendar, calendarField));
|
assertEquals(truncatedCalendar, DateUtils.truncate(lastTruncateCalendar, calendarField));
|
||||||
assertFalse(truncatedCalendar.equals(DateUtils.truncate(nextTruncateCalendar, calendarField)), fdf.format(lastTruncateCalendar) +" is not an extreme when truncating as Calendar with CalendarField-value "+ calendarField);
|
assertNotEquals(truncatedCalendar, DateUtils.truncate(nextTruncateCalendar, calendarField), fdf.format(lastTruncateCalendar) + " is not an extreme when truncating as Calendar with CalendarField-value " + calendarField);
|
||||||
|
|
||||||
//Object-comparison
|
//Object-comparison
|
||||||
assertEquals(truncatedDate, DateUtils.truncate((Object) truncatedDate, calendarField), "Truncating "+ fdf.format(truncatedDate) +" as Date cast to Object with CalendarField-value "+ calendarField +" must return itself as Date");
|
assertEquals(truncatedDate, DateUtils.truncate((Object) truncatedDate, calendarField), "Truncating "+ fdf.format(truncatedDate) +" as Date cast to Object with CalendarField-value "+ calendarField +" must return itself as Date");
|
||||||
assertEquals(truncatedDate, DateUtils.truncate((Object) lastTruncateDate, calendarField));
|
assertEquals(truncatedDate, DateUtils.truncate((Object) lastTruncateDate, calendarField));
|
||||||
assertFalse(truncatedDate.equals(DateUtils.truncate((Object) nextTruncateDate, calendarField)), fdf.format(lastTruncateDate) +" is not an extreme when truncating as Date cast to Object with CalendarField-value "+ calendarField);
|
assertNotEquals(truncatedDate, DateUtils.truncate((Object) nextTruncateDate, calendarField), fdf.format(lastTruncateDate) + " is not an extreme when truncating as Date cast to Object with CalendarField-value " + calendarField);
|
||||||
assertEquals(truncatedDate, DateUtils.truncate((Object) truncatedCalendar, calendarField), "Truncating "+ fdf.format(truncatedCalendar) +" as Calendar cast to Object with CalendarField-value "+ calendarField +" must return itself as Date");
|
assertEquals(truncatedDate, DateUtils.truncate((Object) truncatedCalendar, calendarField), "Truncating "+ fdf.format(truncatedCalendar) +" as Calendar cast to Object with CalendarField-value "+ calendarField +" must return itself as Date");
|
||||||
assertEquals(truncatedDate, DateUtils.truncate((Object) lastTruncateCalendar, calendarField));
|
assertEquals(truncatedDate, DateUtils.truncate((Object) lastTruncateCalendar, calendarField));
|
||||||
assertFalse(truncatedDate.equals(DateUtils.truncate((Object) nextTruncateCalendar, calendarField)), fdf.format(lastTruncateCalendar) +" is not an extreme when truncating as Calendar cast to Object with CalendarField-value "+ calendarField);
|
assertNotEquals(truncatedDate, DateUtils.truncate((Object) nextTruncateCalendar, calendarField), fdf.format(lastTruncateCalendar) + " is not an extreme when truncating as Calendar cast to Object with CalendarField-value " + calendarField);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -717,14 +717,14 @@ protected void roundToJanuaryFirst(final Date minDate, final Date maxDate, final
|
||||||
|
|
||||||
final Date toPrevRoundDate = DateUtils.addMilliseconds(minDate, -1);
|
final Date toPrevRoundDate = DateUtils.addMilliseconds(minDate, -1);
|
||||||
final Date toNextRoundDate = DateUtils.addMilliseconds(maxDate, 1);
|
final Date toNextRoundDate = DateUtils.addMilliseconds(maxDate, 1);
|
||||||
assertFalse(januaryOneDate.equals(DateUtils.round(toPrevRoundDate, calendarField)), fdf.format(minDate) +" is not an lower-extreme when rounding as Date with CalendarField-value "+ calendarField);
|
assertNotEquals(januaryOneDate, DateUtils.round(toPrevRoundDate, calendarField), fdf.format(minDate) + " is not an lower-extreme when rounding as Date with CalendarField-value " + calendarField);
|
||||||
assertFalse(januaryOneDate.equals(DateUtils.round(toNextRoundDate, calendarField)), fdf.format(maxDate) +" is not an upper-extreme when rounding as Date with CalendarField-value "+ calendarField);
|
assertNotEquals(januaryOneDate, DateUtils.round(toNextRoundDate, calendarField), fdf.format(maxDate) + " is not an upper-extreme when rounding as Date with CalendarField-value " + calendarField);
|
||||||
|
|
||||||
final Calendar toPrevRoundCalendar = Calendar.getInstance();
|
final Calendar toPrevRoundCalendar = Calendar.getInstance();
|
||||||
toPrevRoundCalendar.setTime(toPrevRoundDate);
|
toPrevRoundCalendar.setTime(toPrevRoundDate);
|
||||||
final Calendar toNextRoundCalendar = Calendar.getInstance();
|
final Calendar toNextRoundCalendar = Calendar.getInstance();
|
||||||
toNextRoundCalendar.setTime(toNextRoundDate);
|
toNextRoundCalendar.setTime(toNextRoundDate);
|
||||||
assertFalse(januaryOneDate.equals(DateUtils.round(toPrevRoundDate, calendarField)), fdf.format(minCalendar) +" is not an lower-extreme when rounding as Date with CalendarField-value "+ calendarField);
|
assertNotEquals(januaryOneDate, DateUtils.round(toPrevRoundDate, calendarField), fdf.format(minCalendar) + " is not an lower-extreme when rounding as Date with CalendarField-value " + calendarField);
|
||||||
assertFalse(januaryOneDate.equals(DateUtils.round(toNextRoundDate, calendarField)), fdf.format(maxCalendar) +" is not an upper-extreme when rounding as Date with CalendarField-value "+ calendarField);
|
assertNotEquals(januaryOneDate, DateUtils.round(toNextRoundDate, calendarField), fdf.format(maxCalendar) + " is not an upper-extreme when rounding as Date with CalendarField-value " + calendarField);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
@ -397,13 +398,11 @@ public void testLexx() {
|
||||||
|
|
||||||
// test failures in equals
|
// test failures in equals
|
||||||
final DurationFormatUtils.Token token = new DurationFormatUtils.Token(DurationFormatUtils.y, 4);
|
final DurationFormatUtils.Token token = new DurationFormatUtils.Token(DurationFormatUtils.y, 4);
|
||||||
assertFalse(token.equals(new Object()), "Token equal to non-Token class. ");
|
assertNotEquals(token, new Object(), "Token equal to non-Token class. ");
|
||||||
assertFalse(token.equals(new DurationFormatUtils.Token(new Object())),
|
assertNotEquals(token, new DurationFormatUtils.Token(new Object()), "Token equal to Token with wrong value class. ");
|
||||||
"Token equal to Token with wrong value class. ");
|
assertNotEquals(token, new DurationFormatUtils.Token(DurationFormatUtils.y, 1), "Token equal to Token with different count. ");
|
||||||
assertFalse(token.equals(new DurationFormatUtils.Token(DurationFormatUtils.y, 1)),
|
|
||||||
"Token equal to Token with different count. ");
|
|
||||||
final DurationFormatUtils.Token numToken = new DurationFormatUtils.Token(Integer.valueOf(1), 4);
|
final DurationFormatUtils.Token numToken = new DurationFormatUtils.Token(Integer.valueOf(1), 4);
|
||||||
assertTrue(numToken.equals(numToken), "Token with Number value not equal to itself. ");
|
assertEquals(numToken, numToken, "Token with Number value not equal to itself. ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,9 @@
|
||||||
package org.apache.commons.lang3.time;
|
package org.apache.commons.lang3.time;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
import static org.junit.jupiter.api.Assertions.assertNotSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
import static org.junit.jupiter.api.Assertions.fail;
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
import java.text.FieldPosition;
|
import java.text.FieldPosition;
|
||||||
|
@ -64,7 +63,7 @@ public void test_getInstance_String() {
|
||||||
final FastDateFormat format2 = FastDateFormat.getInstance("MM-DD-yyyy");
|
final FastDateFormat format2 = FastDateFormat.getInstance("MM-DD-yyyy");
|
||||||
final FastDateFormat format3 = FastDateFormat.getInstance("MM-DD-yyyy");
|
final FastDateFormat format3 = FastDateFormat.getInstance("MM-DD-yyyy");
|
||||||
|
|
||||||
assertTrue(format1 != format2); // -- junit 3.8 version -- assertFalse(format1 == format2);
|
assertNotSame(format1, format2);
|
||||||
assertSame(format2, format3);
|
assertSame(format2, format3);
|
||||||
assertEquals("MM/DD/yyyy", format1.getPattern());
|
assertEquals("MM/DD/yyyy", format1.getPattern());
|
||||||
assertEquals(TimeZone.getDefault(), format1.getTimeZone());
|
assertEquals(TimeZone.getDefault(), format1.getTimeZone());
|
||||||
|
@ -173,12 +172,12 @@ public void testCheckDifferingStyles() {
|
||||||
final FastDateFormat longShort = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.SHORT, Locale.US);
|
final FastDateFormat longShort = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.SHORT, Locale.US);
|
||||||
final FastDateFormat longLong = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.LONG, Locale.US);
|
final FastDateFormat longLong = FastDateFormat.getDateTimeInstance(FastDateFormat.LONG, FastDateFormat.LONG, Locale.US);
|
||||||
|
|
||||||
assertFalse(shortShort.equals(shortLong));
|
assertNotEquals(shortShort, shortLong);
|
||||||
assertFalse(shortShort.equals(longShort));
|
assertNotEquals(shortShort, longShort);
|
||||||
assertFalse(shortShort.equals(longLong));
|
assertNotEquals(shortShort, longLong);
|
||||||
assertFalse(shortLong.equals(longShort));
|
assertNotEquals(shortLong, longShort);
|
||||||
assertFalse(shortLong.equals(longLong));
|
assertNotEquals(shortLong, longLong);
|
||||||
assertFalse(longShort.equals(longLong));
|
assertNotEquals(longShort, longLong);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -462,7 +463,7 @@ private void testSdfAndFdp(final String format, final String date, final boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// SDF and FDF should produce equivalent results
|
// SDF and FDF should produce equivalent results
|
||||||
assertTrue((f==null)==(s==null), "Should both or neither throw Exceptions");
|
assertEquals((f == null), (s == null), "Should both or neither throw Exceptions");
|
||||||
assertEquals(dsdf, dfdp, "Parsed dates should be equal");
|
assertEquals(dsdf, dfdp, "Parsed dates should be equal");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -554,7 +555,7 @@ public void testEquals() {
|
||||||
assertEquals(parser1, parser2);
|
assertEquals(parser1, parser2);
|
||||||
assertEquals(parser1.hashCode(), parser2.hashCode());
|
assertEquals(parser1.hashCode(), parser2.hashCode());
|
||||||
|
|
||||||
assertFalse(parser1.equals(new Object()));
|
assertNotEquals(parser1, new Object());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
package org.apache.commons.lang3.time;
|
package org.apache.commons.lang3.time;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ public void testEquals() {
|
||||||
assertEquals(printer1, printer2);
|
assertEquals(printer1, printer2);
|
||||||
assertEquals(printer1.hashCode(), printer2.hashCode());
|
assertEquals(printer1.hashCode(), printer2.hashCode());
|
||||||
|
|
||||||
assertFalse(printer1.equals(new Object()));
|
assertNotEquals(printer1, new Object());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -160,7 +160,7 @@ public void testLang315() {
|
||||||
}
|
}
|
||||||
watch.stop();
|
watch.stop();
|
||||||
final long totalTime = watch.getTime();
|
final long totalTime = watch.getTime();
|
||||||
assertTrue(suspendTime == totalTime);
|
assertEquals(suspendTime, totalTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
// test bad states
|
// test bad states
|
||||||
|
|
|
@ -17,11 +17,10 @@
|
||||||
package org.apache.commons.lang3.tuple;
|
package org.apache.commons.lang3.tuple;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -66,12 +65,12 @@ public void testPairOf() {
|
||||||
@Test
|
@Test
|
||||||
public void testEquals() {
|
public void testEquals() {
|
||||||
assertEquals(ImmutablePair.of(null, "foo"), ImmutablePair.of(null, "foo"));
|
assertEquals(ImmutablePair.of(null, "foo"), ImmutablePair.of(null, "foo"));
|
||||||
assertFalse(ImmutablePair.of("foo", 0).equals(ImmutablePair.of("foo", null)));
|
assertNotEquals(ImmutablePair.of("foo", 0), ImmutablePair.of("foo", null));
|
||||||
assertFalse(ImmutablePair.of("foo", "bar").equals(ImmutablePair.of("xyz", "bar")));
|
assertNotEquals(ImmutablePair.of("foo", "bar"), ImmutablePair.of("xyz", "bar"));
|
||||||
|
|
||||||
final ImmutablePair<String, String> p = ImmutablePair.of("foo", "bar");
|
final ImmutablePair<String, String> p = ImmutablePair.of("foo", "bar");
|
||||||
assertTrue(p.equals(p));
|
assertEquals(p, p);
|
||||||
assertFalse(p.equals(new Object()));
|
assertNotEquals(p, new Object());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -17,11 +17,10 @@
|
||||||
package org.apache.commons.lang3.tuple;
|
package org.apache.commons.lang3.tuple;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertSame;
|
import static org.junit.jupiter.api.Assertions.assertSame;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -74,12 +73,12 @@ public void testTripleOf() {
|
||||||
@Test
|
@Test
|
||||||
public void testEquals() {
|
public void testEquals() {
|
||||||
assertEquals(ImmutableTriple.of(null, "foo", 42), ImmutableTriple.of(null, "foo", 42));
|
assertEquals(ImmutableTriple.of(null, "foo", 42), ImmutableTriple.of(null, "foo", 42));
|
||||||
assertFalse(ImmutableTriple.of("foo", 0, Boolean.TRUE).equals(ImmutableTriple.of("foo", null, null)));
|
assertNotEquals(ImmutableTriple.of("foo", 0, Boolean.TRUE), ImmutableTriple.of("foo", null, null));
|
||||||
assertFalse(ImmutableTriple.of("foo", "bar", "baz").equals(ImmutableTriple.of("xyz", "bar", "blo")));
|
assertNotEquals(ImmutableTriple.of("foo", "bar", "baz"), ImmutableTriple.of("xyz", "bar", "blo"));
|
||||||
|
|
||||||
final ImmutableTriple<String, String, String> p = ImmutableTriple.of("foo", "bar", "baz");
|
final ImmutableTriple<String, String, String> p = ImmutableTriple.of("foo", "bar", "baz");
|
||||||
assertTrue(p.equals(p));
|
assertEquals(p, p);
|
||||||
assertFalse(p.equals(new Object()));
|
assertNotEquals(p, new Object());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -17,9 +17,8 @@
|
||||||
package org.apache.commons.lang3.tuple;
|
package org.apache.commons.lang3.tuple;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -72,12 +71,12 @@ public void testPairOf() {
|
||||||
@Test
|
@Test
|
||||||
public void testEquals() {
|
public void testEquals() {
|
||||||
assertEquals(MutablePair.of(null, "foo"), MutablePair.of(null, "foo"));
|
assertEquals(MutablePair.of(null, "foo"), MutablePair.of(null, "foo"));
|
||||||
assertFalse(MutablePair.of("foo", 0).equals(MutablePair.of("foo", null)));
|
assertNotEquals(MutablePair.of("foo", 0), MutablePair.of("foo", null));
|
||||||
assertFalse(MutablePair.of("foo", "bar").equals(MutablePair.of("xyz", "bar")));
|
assertNotEquals(MutablePair.of("foo", "bar"), MutablePair.of("xyz", "bar"));
|
||||||
|
|
||||||
final MutablePair<String, String> p = MutablePair.of("foo", "bar");
|
final MutablePair<String, String> p = MutablePair.of("foo", "bar");
|
||||||
assertTrue(p.equals(p));
|
assertEquals(p, p);
|
||||||
assertFalse(p.equals(new Object()));
|
assertNotEquals(p, new Object());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -17,9 +17,8 @@
|
||||||
package org.apache.commons.lang3.tuple;
|
package org.apache.commons.lang3.tuple;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
@ -79,13 +78,13 @@ public void testTripleOf() {
|
||||||
@Test
|
@Test
|
||||||
public void testEquals() {
|
public void testEquals() {
|
||||||
assertEquals(MutableTriple.of(null, "foo", "baz"), MutableTriple.of(null, "foo", "baz"));
|
assertEquals(MutableTriple.of(null, "foo", "baz"), MutableTriple.of(null, "foo", "baz"));
|
||||||
assertFalse(MutableTriple.of("foo", 0, Boolean.TRUE).equals(MutableTriple.of("foo", null, Boolean.TRUE)));
|
assertNotEquals(MutableTriple.of("foo", 0, Boolean.TRUE), MutableTriple.of("foo", null, Boolean.TRUE));
|
||||||
assertFalse(MutableTriple.of("foo", "bar", "baz").equals(MutableTriple.of("xyz", "bar", "baz")));
|
assertNotEquals(MutableTriple.of("foo", "bar", "baz"), MutableTriple.of("xyz", "bar", "baz"));
|
||||||
assertFalse(MutableTriple.of("foo", "bar", "baz").equals(MutableTriple.of("foo", "bar", "blo")));
|
assertNotEquals(MutableTriple.of("foo", "bar", "baz"), MutableTriple.of("foo", "bar", "blo"));
|
||||||
|
|
||||||
final MutableTriple<String, String, String> p = MutableTriple.of("foo", "bar", "baz");
|
final MutableTriple<String, String, String> p = MutableTriple.of("foo", "bar", "baz");
|
||||||
assertTrue(p.equals(p));
|
assertEquals(p, p);
|
||||||
assertFalse(p.equals(new Object()));
|
assertNotEquals(p, new Object());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertFalse;
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertNotEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||||
|
|
||||||
|
@ -56,7 +57,7 @@ public void testCompatibilityBetweenPairs() {
|
||||||
assertTrue(set.contains(pair2));
|
assertTrue(set.contains(pair2));
|
||||||
|
|
||||||
pair2.setValue("bar");
|
pair2.setValue("bar");
|
||||||
assertFalse(pair.equals(pair2));
|
assertNotEquals(pair, pair2);
|
||||||
assertFalse(pair.hashCode() == pair2.hashCode());
|
assertFalse(pair.hashCode() == pair2.hashCode());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,9 +75,9 @@ public void testMapEntry() {
|
||||||
public void testComparable1() {
|
public void testComparable1() {
|
||||||
final Pair<String, String> pair1 = Pair.of("A", "D");
|
final Pair<String, String> pair1 = Pair.of("A", "D");
|
||||||
final Pair<String, String> pair2 = Pair.of("B", "C");
|
final Pair<String, String> pair2 = Pair.of("B", "C");
|
||||||
assertTrue(pair1.compareTo(pair1) == 0);
|
assertEquals(0, pair1.compareTo(pair1));
|
||||||
assertTrue(pair1.compareTo(pair2) < 0);
|
assertTrue(pair1.compareTo(pair2) < 0);
|
||||||
assertTrue(pair2.compareTo(pair2) == 0);
|
assertEquals(0, pair2.compareTo(pair2));
|
||||||
assertTrue(pair2.compareTo(pair1) > 0);
|
assertTrue(pair2.compareTo(pair1) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,9 +85,9 @@ public void testComparable1() {
|
||||||
public void testComparable2() {
|
public void testComparable2() {
|
||||||
final Pair<String, String> pair1 = Pair.of("A", "C");
|
final Pair<String, String> pair1 = Pair.of("A", "C");
|
||||||
final Pair<String, String> pair2 = Pair.of("A", "D");
|
final Pair<String, String> pair2 = Pair.of("A", "D");
|
||||||
assertTrue(pair1.compareTo(pair1) == 0);
|
assertEquals(0, pair1.compareTo(pair1));
|
||||||
assertTrue(pair1.compareTo(pair2) < 0);
|
assertTrue(pair1.compareTo(pair2) < 0);
|
||||||
assertTrue(pair2.compareTo(pair2) == 0);
|
assertEquals(0, pair2.compareTo(pair2));
|
||||||
assertTrue(pair2.compareTo(pair1) > 0);
|
assertTrue(pair2.compareTo(pair1) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,9 +59,9 @@ public void testCompatibilityBetweenTriples() {
|
||||||
public void testComparable1() {
|
public void testComparable1() {
|
||||||
final Triple<String, String, String> triple1 = Triple.of("A", "D", "A");
|
final Triple<String, String, String> triple1 = Triple.of("A", "D", "A");
|
||||||
final Triple<String, String, String> triple2 = Triple.of("B", "C", "A");
|
final Triple<String, String, String> triple2 = Triple.of("B", "C", "A");
|
||||||
assertTrue(triple1.compareTo(triple1) == 0);
|
assertEquals(0, triple1.compareTo(triple1));
|
||||||
assertTrue(triple1.compareTo(triple2) < 0);
|
assertTrue(triple1.compareTo(triple2) < 0);
|
||||||
assertTrue(triple2.compareTo(triple2) == 0);
|
assertEquals(0, triple2.compareTo(triple2));
|
||||||
assertTrue(triple2.compareTo(triple1) > 0);
|
assertTrue(triple2.compareTo(triple1) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,9 +69,9 @@ public void testComparable1() {
|
||||||
public void testComparable2() {
|
public void testComparable2() {
|
||||||
final Triple<String, String, String> triple1 = Triple.of("A", "C", "B");
|
final Triple<String, String, String> triple1 = Triple.of("A", "C", "B");
|
||||||
final Triple<String, String, String> triple2 = Triple.of("A", "D", "B");
|
final Triple<String, String, String> triple2 = Triple.of("A", "D", "B");
|
||||||
assertTrue(triple1.compareTo(triple1) == 0);
|
assertEquals(0, triple1.compareTo(triple1));
|
||||||
assertTrue(triple1.compareTo(triple2) < 0);
|
assertTrue(triple1.compareTo(triple2) < 0);
|
||||||
assertTrue(triple2.compareTo(triple2) == 0);
|
assertEquals(0, triple2.compareTo(triple2));
|
||||||
assertTrue(triple2.compareTo(triple1) > 0);
|
assertTrue(triple2.compareTo(triple1) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,9 +79,9 @@ public void testComparable2() {
|
||||||
public void testComparable3() {
|
public void testComparable3() {
|
||||||
final Triple<String, String, String> triple1 = Triple.of("A", "A", "D");
|
final Triple<String, String, String> triple1 = Triple.of("A", "A", "D");
|
||||||
final Triple<String, String, String> triple2 = Triple.of("A", "B", "C");
|
final Triple<String, String, String> triple2 = Triple.of("A", "B", "C");
|
||||||
assertTrue(triple1.compareTo(triple1) == 0);
|
assertEquals(0, triple1.compareTo(triple1));
|
||||||
assertTrue(triple1.compareTo(triple2) < 0);
|
assertTrue(triple1.compareTo(triple2) < 0);
|
||||||
assertTrue(triple2.compareTo(triple2) == 0);
|
assertEquals(0, triple2.compareTo(triple2));
|
||||||
assertTrue(triple2.compareTo(triple1) > 0);
|
assertTrue(triple2.compareTo(triple1) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,9 +89,9 @@ public void testComparable3() {
|
||||||
public void testComparable4() {
|
public void testComparable4() {
|
||||||
final Triple<String, String, String> triple1 = Triple.of("B", "A", "C");
|
final Triple<String, String, String> triple1 = Triple.of("B", "A", "C");
|
||||||
final Triple<String, String, String> triple2 = Triple.of("B", "A", "D");
|
final Triple<String, String, String> triple2 = Triple.of("B", "A", "D");
|
||||||
assertTrue(triple1.compareTo(triple1) == 0);
|
assertEquals(0, triple1.compareTo(triple1));
|
||||||
assertTrue(triple1.compareTo(triple2) < 0);
|
assertTrue(triple1.compareTo(triple2) < 0);
|
||||||
assertTrue(triple2.compareTo(triple2) == 0);
|
assertEquals(0, triple2.compareTo(triple2));
|
||||||
assertTrue(triple2.compareTo(triple1) > 0);
|
assertTrue(triple2.compareTo(triple1) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue