0
我有下一個JUnit測試,但是當我執行它時會拋出「對象不是聲明方法的實例」。 它可能是什麼?JUnit異常「對象不是聲明方法的實例」
@Test
public void testCopiarByteArray() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, InstantiationException, UnsupportedEncodingException{
String expected = "prueba";
String mensaje = "prueba";
DataReader datareader = new DataReader(null, null, 100, "=");
Method copiarByteArray = datareader.getClass().getDeclaredMethod("copiarByteArray", byte[].class, int.class);
copiarByteArray.setAccessible(true);
byte[] copia = (byte[]) copiarByteArray.invoke(mensaje.getBytes(), mensaje.getBytes().length);
String actual = new String(copia, "UTF-8");
assertEquals("failure - encription not correctly encript", expected, actual);
}