ModelWriter implements IModelWriter { @Override public void toFile(File file) throws IOException { try (FileOutputStream outputStream = new FileOutputStream(file)) { toOutputStream(outputStream); } } ModelWriter(IModelBuilder modelBuilder); @Override SolvingStrategy getSolvingStrategy(); @Override void setSolvingStrategy(SolvingStrategy solvingStrategy); @Override @Deprecated OutputStatement getOutputStatement(); @Override @Deprecated void setOutputStatement(OutputStatement outputStatement); @Override String toString(); @Override void toFile(File file); @Override void toOutputStream(OutputStream outputStream); @Override File toTempFile(); @Override Collection<Path> getSearchDirectories();  }
@Test public void testCreateSingleSetTemporaryFile() throws IOException { modelBuilder.add(new RangeExpression(1, 99).toNamedConstant("s")); File tempFile = File.createTempFile("jmz", null); try { modelWriter.toFile(tempFile); String result = Files.lines(tempFile.toPath()).collect(Collectors.joining()); Assert.assertEquals("set of int: s = 1..99;", result); } finally { tempFile.delete(); } }