ScenarioIO { public static void write(Scenario s, Path to) throws IOException { Files.write(to, Splitter.on(System.lineSeparator()).split(write(s)), Charsets.UTF_8); } 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 testGraphRmbDirectIO() throws IOException { final Graph<LengthData> g = new TableGraph<>(); g.addConnection(new Point(0, 0), new Point(1, 0)); g.addConnection(new Point(1, 1), new Point(1, 0)); final Scenario s = Scenario.builder() .addModel(TimeModel.builder().withTickLength(7L)) .addModel(RoadModelBuilders.staticGraph(Suppliers.ofInstance(g))) .build(); boolean fail = false; try { ScenarioIO.write(s); } catch (final IllegalArgumentException e) { fail = true; assertThat(e.getMessage()) .isEqualTo("A graph cannot be serialized embedded in a scenario."); } assertThat(fail).isTrue(); }