@Test
public void testConstraintGeneration() {

  final GeometryFactory gf = new GeometryFactory();
  final Geometry multiPolygon =
      gf.createMultiPolygon(
          new Polygon[] {
              gf.createPolygon(
                  new Coordinate[] {
                      new Coordinate(20.0, 30),
                      new Coordinate(20, 40),
                      new Coordinate(10, 40),
                      new Coordinate(10, 30),
                      new Coordinate(20, 30)}),
              gf.createPolygon(
                  new Coordinate[] {
                      new Coordinate(-9, -2),
                      new Coordinate(-9, -1),
                      new Coordinate(-8, -1),
                      new Coordinate(-8, -2),
                      new Coordinate(-9, -2)})});
  final Constraints constraints = GeometryUtils.basicConstraintsFromGeometry(multiPolygon);
  final List<MultiDimensionalNumericData> results =
      constraints.getIndexConstraints(new IndexImpl(new ExampleNumericIndexStrategy(), null));
  assertEquals(2, results.size());
  assertTrue(Arrays.equals(new double[] {10, 30}, results.get(0).getMinValuesPerDimension()));
  assertTrue(Arrays.equals(new double[] {20, 40}, results.get(0).getMaxValuesPerDimension()));
  assertTrue(Arrays.equals(new double[] {-9, -2}, results.get(1).getMinValuesPerDimension()));
  assertTrue(Arrays.equals(new double[] {-8, -1}, results.get(1).getMaxValuesPerDimension()));
}