blob: c09bc00eebfd03594dac8a84fe0e4597ef02d989 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
/*******************************************************************************
* Copyright (c) 2006, 2018 IBM Corporation.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse
*******************************************************************************/
package org.eclipse.linuxtools.systemtap.structures.tests;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.linuxtools.systemtap.structures.Copier;
import org.junit.Test;
public class CopierTest {
@Test
public void testCopy() {
ArrayList<String> list = new ArrayList<>();
@SuppressWarnings("unchecked")
ArrayList<Integer>[] lists = new ArrayList[3];
int listsSize = 3;
for(int i=0; i<listsSize; i++) {
list.add("" + i);
for(int j=0; j<5; j++){
lists[i] = new ArrayList<>();
lists[i].add(j);
}
}
List<String> list2 = Copier.copy(list);
for(int i=0; i<list.size(); i++) {
assertEquals(list2.get(i), list.get(i));
}
List<?>[] lists2 = Copier.copy(lists);
assertArrayEquals(lists, lists2);
}
}
|