Browse Source

Adding test for getComponentType

tags/light-jdk8u74+9
Ivan Dubrov 8 years ago
parent
commit
e278cb949c
1 changed files with 14 additions and 0 deletions
  1. 14
    0
      dcevm/src/test/java7/com/github/dcevm/test/body/ArrayTest.java

+ 14
- 0
dcevm/src/test/java7/com/github/dcevm/test/body/ArrayTest.java View File

import org.junit.Test; import org.junit.Test;


import java.lang.reflect.Array; import java.lang.reflect.Array;
import java.util.Arrays;


import static com.github.dcevm.test.util.HotSwapTestHelper.__toVersion__; import static com.github.dcevm.test.util.HotSwapTestHelper.__toVersion__;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
assertTrue(arr3 instanceof Object[][]); assertTrue(arr3 instanceof Object[][]);
assertEquals(arr3.getClass(), Array.newInstance(B[].class, 0).getClass()); assertEquals(arr3.getClass(), Array.newInstance(B[].class, 0).getClass());
} }

@Test
public void testArrayGetComponentType() {

A[] array = new A[10];

assertEquals(A.class, array.getClass().getComponentType());
__toVersion__(1);

assertEquals(A.class, array.getClass().getComponentType());
array = Arrays.copyOf(array, array.length);
assertEquals(A.class, array.getClass().getComponentType());
}
} }

Loading…
Cancel
Save