### Question:
Convert extends ConsoleCommand { private void convert(String fileFrom, String fileTo) { Path pathFrom = Util.getPath(fileFrom); if (pathFrom == null) { consoleIO.writeError("Invalid file name (from) " + fileFrom); return; } if (Files.notExists(pathFrom)) { consoleIO.writeError("File not found (from) " + fileFrom); return; } Optional<RDFFormat> fmtFrom = Rio.getParserFormatForFileName(fileFrom); if (!fmtFrom.isPresent()) { consoleIO.writeError("No RDF parser for " + fileFrom); return; } Path pathTo = Util.getPath(fileTo); if (pathTo == null) { consoleIO.writeError("Invalid file name (to) " + pathTo); return; } Optional<RDFFormat> fmtTo = Rio.getWriterFormatForFileName(fileTo); if (!fmtTo.isPresent()) { consoleIO.writeError("No RDF writer for " + fileTo); return; } if (Files.exists(pathTo)) { try { boolean overwrite = consoleIO.askProceed("File exists, continue ?", false); if (!overwrite) { consoleIO.writeln("Conversion aborted"); return; } } catch (IOException ioe) { consoleIO.writeError("I/O error " + ioe.getMessage()); } } RDFParser parser = Rio.createParser(fmtFrom.get()); String baseURI = pathFrom.toUri().toString(); try (BufferedInputStream r = new BufferedInputStream(Files.newInputStream(pathFrom)); BufferedWriter w = Files.newBufferedWriter(pathTo)) { RDFWriter writer = Rio.createWriter(fmtTo.get(), w); parser.setRDFHandler(writer); long startTime = System.nanoTime(); consoleIO.writeln("Converting file ..."); parser.parse(r, baseURI); long diff = (System.nanoTime() - startTime) / 1_000_000; consoleIO.writeln("Data has been written to file (" + diff + " ms)"); } catch (IOException | RDFParseException | RDFHandlerException e) { consoleIO.writeError("Failed to convert data: " + e.getMessage()); } } Convert(ConsoleIO consoleIO, ConsoleState state); @Override String getName(); @Override String getHelpShort(); @Override String getHelpLong(); @Override void execute(String... tokens);  }### Answer:
@Test public final void testConvert() throws IOException { File json = LOCATION.newFile("alien.jsonld"); convert.execute("convert", from.toString(), json.toString()); assertTrue("File is empty", json.length() > 0); Object o = null; try { o = JsonUtils.fromInputStream(Files.newInputStream(json.toPath())); } catch (IOException ioe) { } assertTrue("Invalid JSON", o != null); }