### Question:
CountryBoundaries { public List<String> getIds(double longitude, double latitude) { List<String> result = getCell(longitude, latitude).getIds(longitude, latitude); Collections.sort(result, this::compareSize); return result; } 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 delegatesToCorrectCellAtEdges() { CountryBoundaries boundaries = new CountryBoundaries(cells( cell(arrayOf("A"), null), cell(arrayOf("B"), null), cell(arrayOf("C"), null), cell(arrayOf("D"), null) ), 2, Collections.emptyMap()); assertEquals(listOf("C"), boundaries.getIds(-180,-90)); assertEquals(listOf("C"), boundaries.getIds(-90,-90)); assertEquals(listOf("C"), boundaries.getIds(-180,-45)); assertEquals(listOf("A"), boundaries.getIds(-180,0)); assertEquals(listOf("A"), boundaries.getIds(-90,0)); assertEquals(listOf("B"), boundaries.getIds(0,0)); assertEquals(listOf("D"), boundaries.getIds(0,-45)); assertEquals(listOf("D"), boundaries.getIds(0,-90)); }
@Test public void noArrayIndexOutOfBoundsAtWorldEdges() { CountryBoundaries boundaries = new CountryBoundaries( cells(cell(arrayOf("A"), null)), 1, Collections.emptyMap()); boundaries.getIds(-180,-90); boundaries.getIds(+180,+90); boundaries.getIds(-180,+90); boundaries.getIds(+180,-90); }
@Test public void getContainingIdsSortedBySizeAscending() { Map<String, Double> sizes = new HashMap<>(); sizes.put("A", 10.0); sizes.put("B", 15.0); sizes.put("C", 100.0); sizes.put("D", 800.0); CountryBoundaries boundaries = new CountryBoundaries(cells( cell(arrayOf("D","B","C","A"), null) ), 1, sizes); assertEquals(listOf("A","B","C","D"),boundaries.getIds(1,1)); }