MLIOFactory { public MLOutputAdapter getOutputAdapter(String type) { Class<?> c; if (configuration != null) { String className = configuration.getProperty(type); if (className == null) { return new FileOutputAdapter(); } try { c = Class.forName(className); MLOutputAdapter outputAdapter = (MLOutputAdapter) c.newInstance(); return outputAdapter; } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { log.warn(String .format("Failed to load/instantiate the class: %s . Hence, the default implementation %s will be used.", className, FileOutputAdapter.class.getName())); } } return new FileOutputAdapter(); } MLIOFactory(Properties properties); MLInputAdapter getInputAdapter(String type); MLOutputAdapter getOutputAdapter(String type); String getTargetPath(String fileName);  }
@Test public void getOutputAdapter() { MLOutputAdapter outputAdapter = ioFactory.getOutputAdapter("hdfs.output"); Assert.assertEquals(outputAdapter instanceof HdfsOutputAdapter, true); outputAdapter = ioFactory.getOutputAdapter("hdfs"); Assert.assertEquals(outputAdapter instanceof FileOutputAdapter, true); }