I have a private method with such a signature:
private void compressFilesForSend(List<File> files, File archiveFile)
and I want to invoke it in a test through reflection
Class[] parameterTypes = new Class[2];
parameterTypes[0] = java.util.List.class;
parameterTypes[1] = java.io.File.class;
Method method = SendDB.class.getDeclaredMethod("compressFilesForSend",parameterTypes);
method.setAccessible(true);
method.invoke(files, archiveFile);
How can this method be invoked?
Aucun commentaire:
Enregistrer un commentaire