/** * Tests {@link ScenarioIO#readerAdapter(com.google.common.base.Function)}. * @throws IOException When IO fails. */ @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); }