ScenarioIO { public static Function<Path, Scenario> readerAdapter( Function<Scenario, Scenario> converter) { return Functions.compose(converter, reader()); } private  ScenarioIO(); static void write(Scenario s, Path to); static Scenario read(Path file); static ImmutableList<Scenario> read(Iterable<Path> files); static T read(Path file, Class<T> type); static String write(Scenario s); static Scenario read(String scenarioString); static T read(String s, Class<T> type); static Function<Path, Scenario> reader(); static Function<Path, Scenario> readerAdapter(
      Function<Scenario, Scenario> converter); static Function<Path, T> reader(Class<T> clz);  }
@Test public void testReaderAdapter() throws IOException { final Scenario s = Scenario.builder() .addModel(TimeModel.builder().withTickLength(7L)) .build(); final Path tmpDir = Files.createTempDirectory("rinsim-scenario-io-test"); final Path file = Paths.get(tmpDir.toString(), "test.scen"); ScenarioIO.write(s, file); final Scenario out = ScenarioIO.reader().apply(file); final Scenario convertedOut = verifyNotNull(ScenarioIO.readerAdapter(ScenarioConverters.toRealtime()) .apply(file)); assertThat(s).isEqualTo(out); assertThat(s).isNotEqualTo(convertedOut); assertThat(convertedOut.getModelBuilders()) .contains(TimeModel.builder() .withRealTime() .withStartInClockMode(ClockMode.SIMULATED) .withTickLength(7L)); Files.delete(file); Files.delete(tmpDir); }