@Test public void createDirectoryManagerString() throws IOException { Path path = Paths.get(System.getProperty("user.dir")); DirectoryManager dm = DirectoryManagerFactory.createDirectoryManager( System.getProperty("user.dir"), true); assertTrue(dm instanceof DirectoryManagerImpl); DirectoryManagerImpl dmi = (DirectoryManagerImpl) dm; assertTrue(dmi.readOnly); assertEquals(path, dmi.directory); }
public static DirectoryManager createDirectoryManager(Path path, boolean readOnly) throws IOException { try { return dmClass.getConstructor(Path.class, Boolean.class) .newInstance(path, readOnly); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e.toString(), e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof IOException) { throw (IOException) e.getTargetException(); } else { throw new RuntimeException(e.getTargetException().toString(), e.getTargetException()); } } }
DirectoryManagerFactory { public static DirectoryManager createDirectoryManager(Path path, boolean readOnly) throws IOException { try { return dmClass.getConstructor(Path.class, Boolean.class) .newInstance(path, readOnly); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e.toString(), e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof IOException) { throw (IOException) e.getTargetException(); } else { throw new RuntimeException(e.getTargetException().toString(), e.getTargetException()); } } } }
DirectoryManagerFactory { public static DirectoryManager createDirectoryManager(Path path, boolean readOnly) throws IOException { try { return dmClass.getConstructor(Path.class, Boolean.class) .newInstance(path, readOnly); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e.toString(), e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof IOException) { throw (IOException) e.getTargetException(); } else { throw new RuntimeException(e.getTargetException().toString(), e.getTargetException()); } } }  }
DirectoryManagerFactory { public static DirectoryManager createDirectoryManager(Path path, boolean readOnly) throws IOException { try { return dmClass.getConstructor(Path.class, Boolean.class) .newInstance(path, readOnly); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e.toString(), e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof IOException) { throw (IOException) e.getTargetException(); } else { throw new RuntimeException(e.getTargetException().toString(), e.getTargetException()); } } }  static void setDirectoryManagerClass(
			Class<? extends DirectoryManager> clazz); static DirectoryManager createDirectoryManager(Path path,
			boolean readOnly); static DirectoryManager createDirectoryManager(String directory,
			boolean readOnly); }
DirectoryManagerFactory { public static DirectoryManager createDirectoryManager(Path path, boolean readOnly) throws IOException { try { return dmClass.getConstructor(Path.class, Boolean.class) .newInstance(path, readOnly); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException | SecurityException e) { throw new RuntimeException(e.toString(), e); } catch (InvocationTargetException e) { if (e.getTargetException() instanceof IOException) { throw (IOException) e.getTargetException(); } else { throw new RuntimeException(e.getTargetException().toString(), e.getTargetException()); } } }  static void setDirectoryManagerClass(
			Class<? extends DirectoryManager> clazz); static DirectoryManager createDirectoryManager(Path path,
			boolean readOnly); static DirectoryManager createDirectoryManager(String directory,
			boolean readOnly);  }