コード例 #1
0
 public void testReadComment() throws IOException {
   StringWriter writer = new StringWriter();
   format.write(route, new PrintWriter(writer), 0, 2);
   List<BcrRoute> routes =
       format.read(
           new BufferedReader(new StringReader(writer.toString())),
           null,
           BcrFormat.DEFAULT_ENCODING);
   assertEquals(1, routes.size());
   BcrRoute route = routes.get(0);
   List<BcrPosition> positions = route.getPositions();
   assertEquals(2, positions.size());
   BcrPosition position1 = positions.get(0);
   assertEquals("Start", position1.getComment());
   BcrPosition position2 = positions.get(1);
   assertEquals("End", position2.getComment());
 }
コード例 #2
0
 public void testWriteComment() {
   StringWriter writer = new StringWriter();
   format.write(route, new PrintWriter(writer), 0, 2);
   assertTrue(writer.toString().contains("STATION1=Start"));
   assertTrue(writer.toString().contains("STATION2=End"));
 }