public void testArrayCopyArrayTypeMismatch() { try { System.arraycopy(new char[5], 0, new Object[5], 0, 3); fail(); } catch (ArrayStoreException e) { assertEquals("Incompatible types: src=char[], dst=java.lang.Object[]", e.getMessage()); } }
public void testArrayCopySourceNotArray() { try { System.arraycopy("Hello", 0, new char[5], 0, 3); fail(); } catch (ArrayStoreException e) { assertEquals("source of type java.lang.String is not an array", e.getMessage()); } }
public void testArrayCopyElementTypeMismatch() { try { System.arraycopy( new Object[] {null, 5, "hello"}, 0, new Integer[] {1, 2, 3, null, null}, 0, 3); fail(); } catch (ArrayStoreException e) { assertEquals( "source[2] of type java.lang.String cannot be stored in destination array of type java.lang.Integer[]", e.getMessage()); } }