### Question:
JTSUtils { static MultiLineString buildMultiLineString(TDWay outerWay, List<TDWay> innerWays) { List<LineString> lineStrings = new ArrayList<>(); lineStrings.add(buildLineString(outerWay)); if (innerWays != null) { for (TDWay innerWay : innerWays) { LineString innerRing = buildLineString(innerWay); lineStrings.add(innerRing); } } return GEOMETRY_FACTORY.createMultiLineString(lineStrings.toArray(new LineString[lineStrings.size()])); } private  JTSUtils(); static Coordinate toCoordinate(TDNode node); static Coordinate[] toCoordinates(TDWay way); static Geometry toJtsGeometry(TDWay way, List<TDWay> innerWays);  }### Answer:
@Test public void testBuildNonSimpleMultiLineString() { String testfile = "non-simple-multilinestring.wkt"; List<TDWay> ways = MockingUtils.wktMultiLineStringToWays(testfile); MultiLineString mls = JTSUtils.buildMultiLineString(ways.get(0), ways.subList(1, ways.size())); Geometry expected = MockingUtils.readWKTFile(testfile); Assert.isTrue(!mls.isSimple()); Assert.equals(expected, mls); }
@Test public void testBuildValidMultiLineString() { String testfile = "valid-multilinestring.wkt"; List<TDWay> ways = MockingUtils.wktMultiLineStringToWays(testfile); MultiLineString mls = JTSUtils.buildMultiLineString(ways.get(0), ways.subList(1, ways.size())); Geometry expected = MockingUtils.readWKTFile(testfile); Assert.isTrue(mls.isValid()); Assert.equals(expected, mls); }