### Question:
CountryBoundaries { public Set<String> getContainingIds( double minLongitude, double minLatitude, double maxLongitude, double maxLatitude) { Set<String> ids = new HashSet<>(); forCellsIn(minLongitude, minLatitude, maxLongitude, maxLatitude, cell -> { if(ids.isEmpty()) { ids.addAll(cell.getContainingIds()); } else { ids.retainAll(cell.getContainingIds()); } }); return ids; } CountryBoundaries(
			CountryBoundariesCell[] raster, int rasterWidth, Map<String, Double> geometrySizes); static CountryBoundaries load(InputStream is); boolean isInAny(double longitude, double latitude, Collection<String> ids); boolean isIn(double longitude, double latitude, String id); List<String> getIds(double longitude, double latitude); Set<String> getContainingIds(
			double minLongitude, double minLatitude, double maxLongitude, double maxLatitude); Set<String> getIntersectingIds(
			double minLongitude, double minLatitude, double maxLongitude, double maxLatitude); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void getContainingIdsInBBoxWrapsLongitudeCorrectly() { CountryBoundaries boundaries = new CountryBoundaries(cells( cell(arrayOf("A","B","C"), null), cell(arrayOf("A","B"), null) ), 2, Collections.emptyMap()); assertTrue(boundaries.getContainingIds(170,0,-170,1).containsAll( listOf("A","B") )); }
@Test public void geContainingIdsInBBoxIsMergedCorrectly() { CountryBoundaries boundaries = new CountryBoundaries(cells( cell(arrayOf("A","B"), null), cell(arrayOf("B","A"), null), cell(arrayOf("C","B","A"), null), cell(arrayOf("D","A"), null) ), 2, Collections.emptyMap()); assertTrue(boundaries.getContainingIds(-10,-10,10,10).containsAll( listOf("A") )); }
@Test public void geContainingIdsInBBoxIsMergedCorrectlyAnNothingIsLeft() { CountryBoundaries boundaries = new CountryBoundaries(cells( cell(arrayOf("A"), null), cell(arrayOf("B"), null), cell(arrayOf("C"), null), cell(arrayOf("D"), null) ), 2, Collections.emptyMap()); assertTrue(boundaries.getContainingIds(-10,-10,10,10).containsAll( listOf() )); }