public class TestJavaObject_getReferences extends TCKJavaRuntimeTestcase {
public void testMultiDimensionalArrayReferences() {
try {
JavaObject thisObject = getScenerioReference();
JavaField multiDimArrayField = getJavaField(thisObject, "multiDimArray");
Object multiDimArrayObject = multiDimArrayField.get(thisObject);
if (multiDimArrayObject instanceof JavaObject) {
JavaObject mdObject = (JavaObject)multiDimArrayObject;
Iterator refs = mdObject.getReferences().iterator();
while (refs.hasNext()) {
Object next = refs.next();
if (next instanceof JavaReference) {
JavaReference ref = (JavaReference) next;
try {
Object target = ref.getTarget();
if (target instanceof JavaObject) {
JavaObject targetObject = (JavaObject) target;
System.out.println(targetObject.getJavaClass().getName());
}
System.out.println(ref.getDescription());
} catch (DataUnavailable e) {
e.printStackTrace();
}