FileInputAdapter implements MLInputAdapter { @Override public InputStream read(String path) throws MLInputAdapterException { try { FileInputStream inputStream = new FileInputStream(new File(path)); return inputStream; } catch (FileNotFoundException | IllegalArgumentException e) { throw new MLInputAdapterException(String.format("Failed to read the data-set from uri %s: %s", path, e), e); } }  @Override InputStream read(String path);  }
@Test public void testReadDataset() throws URISyntaxException, MLInputAdapterException { MLInputAdapter inputAdapter = new FileInputAdapter(); String filePrefix = ""; String uriString = "src" + File.separator + "test" + File.separator + "resources" + File.separator + "fcSample.csv"; String uri = filePrefix + uriString; InputStream in = null; try { in = inputAdapter.read(uri); } catch (Exception e) { Assert.assertEquals(e instanceof MLInputAdapterException, true); } uri = filePrefix + System.getProperty("user.dir") + File.separator + uriString; in = inputAdapter.read(uri); Assert.assertNotNull(in); uri = System.getProperty("user.dir") + File.separator + uriString; in = inputAdapter.read(uri); Assert.assertNotNull(in); uri = System.getProperty("user.dir") + File.separator + uriString + ".csv"; try { in = inputAdapter.read(uri); } catch (Exception e) { Assert.assertEquals(e instanceof MLInputAdapterException, true); } }