### Question:
Export extends ConsoleCommand { @Override public void execute(String... tokens) { Repository repository = state.getRepository(); if (repository == null) { consoleIO.writeUnopenedError(); return; } if (tokens.length < 2) { consoleIO.writeln(getHelpLong()); return; } String fileName = tokens[1]; Resource[] contexts; try { contexts = Util.getContexts(tokens, 2, repository); } catch (IllegalArgumentException ioe) { consoleIO.writeError(ioe.getMessage()); return; } export(repository, fileName, contexts); } Export(ConsoleIO consoleIO, ConsoleState state); @Override String getName(); @Override String getHelpShort(); @Override String getHelpLong(); @Override void execute(String... tokens);  }### Answer:
@Test public final void testExportAll() throws RepositoryException, IOException { File nq = LOCATION.newFile("all.nq"); export.execute("export", nq.toString()); Model exp = Rio.parse(Files.newReader(nq, StandardCharsets.UTF_8), "http: assertTrue("File is empty", nq.length() > 0); assertEquals("Number of contexts incorrect", 3, exp.contexts().size()); nq.delete(); }
@Test public final void testExportContexts() throws RepositoryException, IOException { File nq = LOCATION.newFile("default.nq"); export.execute("export", nq.toString(), "null", "http: Model exp = Rio.parse(Files.newReader(nq, StandardCharsets.UTF_8), "http: assertTrue("File is empty", nq.length() > 0); assertEquals("Number of contexts incorrect", 2, exp.contexts().size()); assertEquals("Number of triples incorrect", 4, exp.size()); nq.delete(); }