### Question:
XYGridTree implements Serializable { public CellId getInsertId(OSHDBBoundingBox bbox) { for (int i=maxLevel; i>=0; i--) { if (gridMap.get(i).getEstimatedIdCount(bbox) > 2) { continue; } return new CellId(i, gridMap.get(i).getId(bbox.getMinLonLong(), bbox.getMinLatLong())); } return null; } XYGridTree(int maxzoom);  XYGridTree(); @SuppressWarnings("Convert2Lambda") Iterable<CellId> getIds(long longitude, long latitude); Iterable<CellId> getIds(double longitude, double latitude); CellId getInsertId(OSHDBBoundingBox bbox); Iterable<CellId> bbox2CellIds(final OSHDBBoundingBox BBOX); @SuppressWarnings("Convert2Lambda") Iterable<CellId> bbox2CellIds(final OSHDBBoundingBox BBOX, final boolean enlarge); @SuppressWarnings("Convert2Lambda") Iterable<CellIdRange> bbox2CellIdRanges(final OSHDBBoundingBox bbox, final boolean enlarge);  }### Answer:
@Test public void testGetInsertId() { OSHDBBoundingBox bbox = new OSHDBBoundingBox(0.0, -90.0, 179.0, 90.0); XYGridTree instance = new XYGridTree(4); CellId expResult = new CellId(2, 2L); CellId result = instance.getInsertId(bbox); assertEquals(expResult.getId(), result.getId()); assertEquals(expResult.getZoomLevel(), result.getZoomLevel()); bbox = new OSHDBBoundingBox(0.0, -90.0, 0.1, 90.0); instance = new XYGridTree(4); expResult = new CellId(2, 2L); result = instance.getInsertId(bbox); assertEquals(expResult.getId(), result.getId()); assertEquals(expResult.getZoomLevel(), result.getZoomLevel()); bbox = new OSHDBBoundingBox(0.0, -90.0, 179.0, -89.9); instance = new XYGridTree(4); expResult = new CellId(2, 2L); result = instance.getInsertId(bbox); assertEquals(expResult.getId(), result.getId()); assertEquals(expResult.getZoomLevel(), result.getZoomLevel()); }