mirror of
https://github.com/bitfireAT/davx5-ose.git
synced 2026-09-13 06:42:40 -04:00
* update to Lombok 1.16.4 and dnsjava 2.1.7 * optimize imports and copyrights * delete Note data class (will be implemented later)
40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
/*
|
||
* Copyright © 2013 – 2015 Ricki Hirner (bitfire web engineering).
|
||
* All rights reserved. This program and the accompanying materials
|
||
* are made available under the terms of the GNU Public License v3.0
|
||
* which accompanies this distribution, and is available at
|
||
* http://www.gnu.org/licenses/gpl.html
|
||
*/
|
||
package at.bitfire.davdroid;
|
||
|
||
import junit.framework.TestCase;
|
||
|
||
import java.util.Arrays;
|
||
|
||
|
||
public class ArrayUtilsTest extends TestCase {
|
||
|
||
public void testPartition() {
|
||
// n == 0
|
||
assertTrue(Arrays.deepEquals(
|
||
new Long[0][0],
|
||
ArrayUtils.partition(new Long[] { }, 5)));
|
||
|
||
// n < max
|
||
assertTrue(Arrays.deepEquals(
|
||
new Long[][] { { 1l, 2l } },
|
||
ArrayUtils.partition(new Long[] { 1l, 2l }, 5)));
|
||
|
||
// n == max
|
||
assertTrue(Arrays.deepEquals(
|
||
new Long[][] { { 1l, 2l }, { 3l, 4l } },
|
||
ArrayUtils.partition(new Long[] { 1l, 2l, 3l, 4l }, 2)));
|
||
|
||
// n > max
|
||
assertTrue(Arrays.deepEquals(
|
||
new Long[][] { { 1l, 2l, 3l, 4l, 5l }, { 6l, 7l, 8l, 9l, 10l }, { 11l } },
|
||
ArrayUtils.partition(new Long[] { 1l, 2l, 3l, 4l, 5l, 6l, 7l, 8l, 9l, 10l, 11l }, 5)));
|
||
}
|
||
|
||
}
|