@TestFactory
  List<DynamicNode> testConnectPolygonSegments() {
    return List.of(
      testConnect(List.of(), List.of()),
      testConnect(List.of(longs(1)), List.of()),
      testConnect(List.of(longs(1, 2)), List.of()),
      testConnect(List.of(longs(1, 2, 1)), List.of()),
      testConnect(List.of(longs(1, 2, 3, 1)), List.of(longs(1, 2, 3, 1))),
      testConnect(List.of(
        longs(1, 2),
        longs(3, 2),
        longs(3, 1)
      ), List.of(longs(1, 2, 3, 1))),
      testConnect(List.of(
        longs(10, 11, 10),
        longs(1, 2),
        longs(3, 2),
        longs(3, 1),
        longs(4, 5),
        longs(5, 6),
        longs(6, 4)
      ), List.of(
        longs(4, 5, 6, 4),
        longs(1, 2, 3, 1)
      )),
      testConnect(List.of(
        longs(1L, 2L),
        longs(3L, 4L),
        longs(4L, 5L),
        longs(5L, 6L),
        longs(6L, 7L),
        longs(3L, 2L),
        longs(7L, 1L)
      ), List.of(
        longs(1, 2, 3, 4, 5, 6, 7, 1)
      ))
    );
  }
This class is ported to Java from https://github.com/omniscale/imposm3/blob/master/geom/multipolygon_test.go
planetiler-core/src/test/java/com/onthegomap/planetiler/reader/osm/OsmMultipolygonTest.java