### Question:
TopLevelGeometryProvider { public List<AbstractTileGeometry<?>> getTopLevelGeometries(String layerId) { List<AbstractTileGeometry<?>> geometries = New.list(); for (Geometry geometry : myGeometryRegistry.getGeometries()) { if (geometry instanceof AbstractTileGeometry) { AbstractTileGeometry<?> tile = (AbstractTileGeometry<?>)geometry; if (layerId.equals(tile.getLayerId())) { geometries.add(tile.clone()); } } } return geometries; } TopLevelGeometryProvider(GeometryRegistry geometryRegistry); List<AbstractTileGeometry<?>> getTopLevelGeometries(String layerId);  }### Answer:
@Test public void testGetTopLevelGeometries() { EasyMockSupport support = new EasyMockSupport(); TileRenderProperties props = support.createNiceMock(TileRenderProperties.class); ZOrderRenderProperties zProps = support.createNiceMock(ZOrderRenderProperties.class); @SuppressWarnings("unchecked") ImageProvider<String> imageProvider = support.createNiceMock(ImageProvider.class); ImageManager imageManager = new ImageManager("key", imageProvider); Geometry geometry = support.createMock(Geometry.class); Collection<Geometry> geometries = New.list(); GeometryRegistry geomRegistry = createGeomRegistry(support, geometries); support.replayAll(); GeographicBoundingBox outside = new GeographicBoundingBox(LatLonAlt.createFromDegrees(5, -5), LatLonAlt.createFromDegrees(10, .0001)); GeographicBoundingBox intersects = new GeographicBoundingBox(LatLonAlt.createFromDegrees(5, -5), LatLonAlt.createFromDegrees(10, 15)); GeographicBoundingBox contained = new GeographicBoundingBox(LatLonAlt.createFromDegrees(2, 2), LatLonAlt.createFromDegrees(7, 7)); TileGeometry.Builder<GeographicPosition> builder = new Builder<>(); builder.setBounds(outside); TileGeometry outSideGeom = new TileGeometry(builder, props, null, "notmine"); builder = new Builder<>(); builder.setBounds(intersects); TileGeometry intersectsGeom = new TileGeometry(builder, props, null, "mine"); TerrainTileGeometry.Builder<GeographicPosition> terrainBuilder = new TerrainTileGeometry.Builder<>(); terrainBuilder.setBounds(contained); terrainBuilder.setImageManager(imageManager); TerrainTileGeometry containedGeom = new TerrainTileGeometry(terrainBuilder, zProps, "mine"); geometries.add(geometry); geometries.add(outSideGeom); geometries.add(intersectsGeom); geometries.add(containedGeom); TopLevelGeometryProvider provider = new TopLevelGeometryProvider(geomRegistry); List<AbstractTileGeometry<?>> tops = provider.getTopLevelGeometries("mine"); assertEquals(2, tops.size()); assertEquals(intersectsGeom.getBounds(), tops.get(0).getBounds()); org.junit.Assert.assertNotSame(intersectsGeom, tops.get(0)); assertEquals(containedGeom.getBounds(), tops.get(1).getBounds()); org.junit.Assert.assertNotSame(containedGeom, tops.get(1)); support.verifyAll(); }