Fixed the indentation in ArrayUtilsTest

This commit is contained in:
Emmanuel Bourg 2017-04-18 22:52:21 +02:00
parent a91f76da21
commit 5a52446090
1 changed files with 131 additions and 131 deletions

View File

@ -4345,39 +4345,39 @@ public class ArrayUtilsTest {
// testToPrimitive/Object for int // testToPrimitive/Object for int
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@Test @Test
public void testToPrimitive_int() { public void testToPrimitive_int() {
final Integer[] b = null; final Integer[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b)); assertEquals(null, ArrayUtils.toPrimitive(b));
assertSame(ArrayUtils.EMPTY_INT_ARRAY, ArrayUtils.toPrimitive(new Integer[0])); assertSame(ArrayUtils.EMPTY_INT_ARRAY, ArrayUtils.toPrimitive(new Integer[0]));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999}, new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE), ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
Integer.valueOf(Integer.MAX_VALUE), Integer.valueOf(9999999)})) Integer.valueOf(Integer.MAX_VALUE), Integer.valueOf(9999999)}))
); );
try { try {
ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE), null}); ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE), null});
fail(); fail();
} catch (final NullPointerException ex) {} } catch (final NullPointerException ex) {}
} }
@Test @Test
public void testToPrimitive_int_int() { public void testToPrimitive_int_int() {
final Long[] l = null; final Long[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Integer.MIN_VALUE)); assertEquals(null, ArrayUtils.toPrimitive(l, Integer.MIN_VALUE));
assertSame(ArrayUtils.EMPTY_INT_ARRAY, assertSame(ArrayUtils.EMPTY_INT_ARRAY,
ArrayUtils.toPrimitive(new Integer[0], 1)); ArrayUtils.toPrimitive(new Integer[0], 1));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999}, new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE), ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
Integer.valueOf(Integer.MAX_VALUE), Integer.valueOf(9999999)},1))); Integer.valueOf(Integer.MAX_VALUE), Integer.valueOf(9999999)},1)));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999}, new int[] {Integer.MIN_VALUE, Integer.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE), ArrayUtils.toPrimitive(new Integer[] {Integer.valueOf(Integer.MIN_VALUE),
null, Integer.valueOf(9999999)}, Integer.MAX_VALUE)) null, Integer.valueOf(9999999)}, Integer.MAX_VALUE))
); );
} }
@Test @Test
public void testToPrimitive_intNull() { public void testToPrimitive_intNull() {
@ -4406,45 +4406,45 @@ public class ArrayUtilsTest {
// testToPrimitive/Object for long // testToPrimitive/Object for long
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@Test @Test
public void testToPrimitive_long() { public void testToPrimitive_long() {
final Long[] b = null; final Long[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b)); assertEquals(null, ArrayUtils.toPrimitive(b));
assertSame(ArrayUtils.EMPTY_LONG_ARRAY, assertSame(ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.toPrimitive(new Long[0])); ArrayUtils.toPrimitive(new Long[0]));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999}, new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE), ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
Long.valueOf(Long.MAX_VALUE), Long.valueOf(9999999)})) Long.valueOf(Long.MAX_VALUE), Long.valueOf(9999999)}))
); );
try { try {
ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE), null}); ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE), null});
fail(); fail();
} catch (final NullPointerException ex) {} } catch (final NullPointerException ex) {}
} }
@Test @Test
public void testToPrimitive_long_long() { public void testToPrimitive_long_long() {
final Long[] l = null; final Long[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Long.MIN_VALUE)); assertEquals(null, ArrayUtils.toPrimitive(l, Long.MIN_VALUE));
assertSame(ArrayUtils.EMPTY_LONG_ARRAY, assertSame(ArrayUtils.EMPTY_LONG_ARRAY,
ArrayUtils.toPrimitive(new Long[0], 1)); ArrayUtils.toPrimitive(new Long[0], 1));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999}, new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE), ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
Long.valueOf(Long.MAX_VALUE), Long.valueOf(9999999)},1))); Long.valueOf(Long.MAX_VALUE), Long.valueOf(9999999)},1)));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999}, new long[] {Long.MIN_VALUE, Long.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE), ArrayUtils.toPrimitive(new Long[] {Long.valueOf(Long.MIN_VALUE),
null, Long.valueOf(9999999)}, Long.MAX_VALUE)) null, Long.valueOf(9999999)}, Long.MAX_VALUE))
); );
} }
@Test @Test
public void testToObject_long() { public void testToObject_long() {
@ -4467,45 +4467,45 @@ public class ArrayUtilsTest {
// testToPrimitive/Object for float // testToPrimitive/Object for float
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@Test @Test
public void testToPrimitive_float() { public void testToPrimitive_float() {
final Float[] b = null; final Float[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b)); assertEquals(null, ArrayUtils.toPrimitive(b));
assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY, assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.toPrimitive(new Float[0])); ArrayUtils.toPrimitive(new Float[0]));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999}, new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE), ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
Float.valueOf(Float.MAX_VALUE), Float.valueOf(9999999)})) Float.valueOf(Float.MAX_VALUE), Float.valueOf(9999999)}))
); );
try { try {
ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE), null}); ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE), null});
fail(); fail();
} catch (final NullPointerException ex) {} } catch (final NullPointerException ex) {}
} }
@Test @Test
public void testToPrimitive_float_float() { public void testToPrimitive_float_float() {
final Float[] l = null; final Float[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Float.MIN_VALUE)); assertEquals(null, ArrayUtils.toPrimitive(l, Float.MIN_VALUE));
assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY, assertSame(ArrayUtils.EMPTY_FLOAT_ARRAY,
ArrayUtils.toPrimitive(new Float[0], 1)); ArrayUtils.toPrimitive(new Float[0], 1));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999}, new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE), ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
Float.valueOf(Float.MAX_VALUE), Float.valueOf(9999999)},1))); Float.valueOf(Float.MAX_VALUE), Float.valueOf(9999999)},1)));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999}, new float[] {Float.MIN_VALUE, Float.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE), ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE),
null, Float.valueOf(9999999)}, Float.MAX_VALUE)) null, Float.valueOf(9999999)}, Float.MAX_VALUE))
); );
} }
@Test @Test
public void testToObject_float() { public void testToObject_float() {
@ -4528,45 +4528,45 @@ public class ArrayUtilsTest {
// testToPrimitive/Object for double // testToPrimitive/Object for double
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
@Test @Test
public void testToPrimitive_double() { public void testToPrimitive_double() {
final Double[] b = null; final Double[] b = null;
assertEquals(null, ArrayUtils.toPrimitive(b)); assertEquals(null, ArrayUtils.toPrimitive(b));
assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY, assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.toPrimitive(new Double[0])); ArrayUtils.toPrimitive(new Double[0]));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999}, new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE), ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
Double.valueOf(Double.MAX_VALUE), Double.valueOf(9999999)})) Double.valueOf(Double.MAX_VALUE), Double.valueOf(9999999)}))
); );
try { try {
ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE), null}); ArrayUtils.toPrimitive(new Float[] {Float.valueOf(Float.MIN_VALUE), null});
fail(); fail();
} catch (final NullPointerException ex) {} } catch (final NullPointerException ex) {}
} }
@Test @Test
public void testToPrimitive_double_double() { public void testToPrimitive_double_double() {
final Double[] l = null; final Double[] l = null;
assertEquals(null, ArrayUtils.toPrimitive(l, Double.MIN_VALUE)); assertEquals(null, ArrayUtils.toPrimitive(l, Double.MIN_VALUE));
assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY, assertSame(ArrayUtils.EMPTY_DOUBLE_ARRAY,
ArrayUtils.toPrimitive(new Double[0], 1)); ArrayUtils.toPrimitive(new Double[0], 1));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999}, new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE), ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
Double.valueOf(Double.MAX_VALUE), Double.valueOf(9999999)},1))); Double.valueOf(Double.MAX_VALUE), Double.valueOf(9999999)},1)));
assertTrue(Arrays.equals( assertTrue(Arrays.equals(
new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999}, new double[] {Double.MIN_VALUE, Double.MAX_VALUE, 9999999},
ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE), ArrayUtils.toPrimitive(new Double[] {Double.valueOf(Double.MIN_VALUE),
null, Double.valueOf(9999999)}, Double.MAX_VALUE)) null, Double.valueOf(9999999)}, Double.MAX_VALUE))
); );
} }
@Test @Test
public void testToObject_double() { public void testToObject_double() {
@ -4661,7 +4661,7 @@ public class ArrayUtilsTest {
assertFalse(ArrayUtils.isEmpty(notEmptyBooleanArray)); assertFalse(ArrayUtils.isEmpty(notEmptyBooleanArray));
} }
/** /**
* Test for {@link ArrayUtils#isNotEmpty(java.lang.Object[])}. * Test for {@link ArrayUtils#isNotEmpty(java.lang.Object[])}.
*/ */
@Test @Test
@ -4673,7 +4673,7 @@ public class ArrayUtilsTest {
assertTrue(ArrayUtils.isNotEmpty(notEmptyArray)); assertTrue(ArrayUtils.isNotEmpty(notEmptyArray));
} }
/** /**
* Tests for {@link ArrayUtils#isNotEmpty(long[])}, * Tests for {@link ArrayUtils#isNotEmpty(long[])},
* {@link ArrayUtils#isNotEmpty(int[])}, * {@link ArrayUtils#isNotEmpty(int[])},
* {@link ArrayUtils#isNotEmpty(short[])}, * {@link ArrayUtils#isNotEmpty(short[])},