public void testAtomic() throws Exception {
   Polygon g = (Polygon) read("POLYGON ((1 9, 9 9, 9 1, 1 1, 1 9))");
   GeometryCollectionIterator i = new GeometryCollectionIterator(g);
   assertTrue(i.hasNext());
   assertTrue(i.next() instanceof Polygon);
   assertTrue(!i.hasNext());
 }
 public void testGeometryCollection() throws Exception {
   GeometryCollection g =
       (GeometryCollection) read("GEOMETRYCOLLECTION (GEOMETRYCOLLECTION (POINT (10 10)))");
   GeometryCollectionIterator i = new GeometryCollectionIterator(g);
   assertTrue(i.hasNext());
   assertTrue(i.next() instanceof GeometryCollection);
   assertTrue(i.hasNext());
   assertTrue(i.next() instanceof GeometryCollection);
   assertTrue(i.hasNext());
   assertTrue(i.next() instanceof Point);
   assertTrue(!i.hasNext());
 }