This commit is contained in:
Gary Gregory 2024-05-12 14:26:43 -04:00
parent 8133410b1c
commit 44f62a10e6
1 changed files with 10 additions and 0 deletions

View File

@ -36,7 +36,9 @@ import java.util.Comparator;
import java.util.Date;
import java.util.Map;
import java.util.Random;
import java.util.function.Supplier;
import org.apache.commons.lang3.function.Suppliers;
import org.junit.jupiter.api.Test;
/**
@ -69,6 +71,14 @@ public class ArrayUtilsTest extends AbstractLangTest {
assertFalse(ArrayUtils.isEquals(array2, array1));
}
@Test
public void testArraycopy() {
String[] arr = { "a", "b" };
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, (Supplier<String[]>) null));
}
/**
* Tests generic array creation with parameters of same type.
*/