mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-07 02:28:25 +00:00
Add test
This commit is contained in:
parent
7c1788334a
commit
5e36226a06
@ -36,6 +36,7 @@
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
import org.apache.commons.lang3.function.Suppliers;
|
import org.apache.commons.lang3.function.Suppliers;
|
||||||
@ -72,7 +73,15 @@ private void assertIsEquals(final Object array1, final Object array2, final Obje
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testArraycopy() {
|
public void testArraycopyFunction() {
|
||||||
|
String[] arr = { "a", "b" };
|
||||||
|
assertThrows(NullPointerException.class, () -> ArrayUtils.arraycopy(null, 0, 0, 1, i -> new String[3]));
|
||||||
|
assertThrows(NullPointerException.class, () -> ArrayUtils.arraycopy(arr, 0, 0, 1, i -> null));
|
||||||
|
assertThrows(NullPointerException.class, () -> ArrayUtils.arraycopy(arr, 0, 0, 1, (Function<Integer, String[]>) null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testArraycopySupplier() {
|
||||||
String[] arr = { "a", "b" };
|
String[] arr = { "a", "b" };
|
||||||
assertThrows(NullPointerException.class, () -> ArrayUtils.arraycopy(null, 0, 0, 1, () -> new String[3]));
|
assertThrows(NullPointerException.class, () -> ArrayUtils.arraycopy(null, 0, 0, 1, () -> new String[3]));
|
||||||
assertThrows(NullPointerException.class, () -> ArrayUtils.arraycopy(arr, 0, 0, 1, Suppliers.nul()));
|
assertThrows(NullPointerException.class, () -> ArrayUtils.arraycopy(arr, 0, 0, 1, Suppliers.nul()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user