### Question:
VFS { @SuppressWarnings("unchecked") protected static <T> T invoke(Method method, Object object, Object... parameters) throws IOException, RuntimeException { try { return (T) method.invoke(object, parameters); } catch (IllegalArgumentException | IllegalAccessException e) { throw new RuntimeException(e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof IOException) { throw (IOException) e.getTargetException(); } else { throw new RuntimeException(e); } } }  static VFS getInstance(); static void addImplClass(Class<? extends VFS> clazz); abstract boolean isValid(); List<String> list(String path); static final Class<?>[] IMPLEMENTATIONS; static final List<Class<? extends VFS>> USER_IMPLEMENTATIONS; }### Answer:
@Test void invoke() throws IOException, NoSuchMethodException { VFS vfs = VFS.invoke(VFS.class.getMethod("getInstance"), VFS.class); Assertions.assertEquals(vfs, VFS.getInstance()); Assertions.assertThrows(RuntimeException.class, () -> { VFS.invoke(VFS.class.getMethod("getInstance"), VFS.class, "unnecessaryArgument"); }); Assertions.assertThrows(IOException.class, () -> { VFS.invoke(Resources.class.getMethod("getResourceAsProperties", String.class), Resources.class, "invalidResource"); }); Assertions.assertThrows(RuntimeException.class, () -> { VFS.invoke(Integer.class.getMethod("valueOf", String.class), Resources.class, "InvalidIntegerNumber"); }); }