assertNull(references);
}
public void testNestedReferencesRemoveAtHigherLevel()
{
ArrayRegistry registry = ArrayRegistry.getInstance();
int[] arr = new int[] {1, 2, 3};
ClassForReference obj = new ClassForReference();
Object[][][][] fieldA = new Object[][][][] {null, null, new Object[][][] {null, new Object[][] {null, null, new Object[] {null, null, null, arr}}}}; //2, 1, 2, 3
obj.fieldA = fieldA;
List<ArrayReference> references = registry.getArrayOwners(arr);
assertEquals(1, references.size());
ArrayReference reference = references.get(0);
assertEquals(obj, reference.getRootObject());
assertEquals("fieldA", reference.getRootField());
assertEquals(4, reference.getNestedArrayIndices().size());
assertEquals(new Integer(2), reference.getNestedArrayIndices().get(0));
assertEquals(new Integer(1), reference.getNestedArrayIndices().get(1));
assertEquals(new Integer(2), reference.getNestedArrayIndices().get(2));
assertEquals(new Integer(3), reference.getNestedArrayIndices().get(3));
fieldA[2][1] = null;
references = registry.getArrayOwners(arr);
assertNull(references);
}