AbstractIOFactory implements IOFactory<T> { @SuppressWarnings("unchecked") public IOCapabilities getCapabilities(String mimeType) { Class<? extends T> clazz = entries.get(mimeType); try { Method capabilitiesGetter = clazz.getMethod("getCapabilities"); Set<IOCapabilities> capabilities = (Set<IOCapabilities>) capabilitiesGetter.invoke(clazz); for (IOCapabilities c : capabilities) { if (c.getMimeType().equals(mimeType)) { return c; } } } catch (SecurityException | InvocationTargetException | IllegalAccessException | IllegalArgumentException | NoSuchMethodException e) { e.printStackTrace(); } return null; } @SuppressWarnings("unchecked") protected  AbstractIOFactory(String propFileName); @SuppressWarnings("unchecked") IOCapabilities getCapabilities(String mimeType); List<IOCapabilities> getCapabilities(); String[] getSupportedFormats(); boolean isFormatSupported(String mimeType); T get(String mimeType);  }
@Test public void testCapabilities() { TestIOFactory f = null; try { f = new TestIOFactory("datareaders.properties"); } catch (IOException e) { fail("Creation of IOFactory failed: "+e); } List<IOCapabilities> caps = f.getCapabilities(); assertTrue(caps.size() > 0); }