[classlib][luni] java.util.ArrayList.addAll(int index, Collection<? extends E> c) fails
to add itself
-----------------------------------------------------------------------------------------------------
Key: HARMONY-6141
URL: https://issues.apache.org/jira/browse/HARMONY-6141
Project: Harmony
Issue Type: Bug
Components: Classlib
Affects Versions: 5.0M8
Reporter: Kevin Zhou
Fix For: 5.0M9
Given a test case [1], both of these two scenarios are used to test java.util.ArrayList.addAll(int
index, Collection<? extends E> c) method.
For scenario1, initialize two array list "arrayListA" and "arrayListB", add 1 to them respectively;
then invoke arrayListA.addAll(arrayListB); finally "arrayListA" should be like [1, 1]
For scenario2, initialize an array list "arrayList", add one element to it; then try to add
itself in the position of 1; finally "arrayList" should look like [1, 1] as well.
Conduct this test scenarios on RI and HY, RI passes all while HY fails on the 2nd scenario.
[1] Test Case:
public void test_ArrayList_addAll_scenario1() {
ArrayList arrayListA = new ArrayList();
arrayListA.add(1);
ArrayList arrayListB = new ArrayList();
arrayListB.add(1);
arrayListA.addAll(1, arrayListB);
int size = arrayListA.size();
assertEquals(2, size);
for (int index = 0; index < size; index++) {
assertEquals(1, arrayListA.get(index));
}
}
public void test_ArrayList_addAll_scenario2() {
ArrayList arrayList = new ArrayList();
arrayList.add(1);
arrayList.addAll(1, arrayList);
int size = arrayList.size();
assertEquals(2, size);
for (int index = 0; index < size; index++) {
assertEquals(1, arrayList.get(index));
}
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
|