NestedAggGeoHashGrid extends GeoHashGrid { Number bucketToRaster(String key, Number value) { Number rasterValue = value; if (rasterStrategy.equals(RASTER_FROM_KEY)) { if (null != termsMap) { if (termsMap.containsKey(key)) { rasterValue = termsMap.get(key); } else { LOGGER.warning("Cannot convert key (String) to raster value, mapping does not contain key " + key + ". Add key to terms_map argument to resolve."); throw new IllegalArgumentException(); } } else { try { rasterValue = Double.valueOf(key); } catch (NumberFormatException nfe) { LOGGER.warning("Cannot convert key (String) to raster value, key, " + key + ", is not a number. Use terms_map argument to map Strings to Numbers."); throw new IllegalArgumentException(); } } } return rasterValue; }  @Override void setParams(List<String> params); @Override Number computeCellValue(Map<String,Object> geogridBucket); String getNestedAggKey(); String getMetricKey(); String getValueKey(); String getSelectionStrategy(); String getRasterStrategy(); Map<String, Integer> getTermsMap();  }
@Test public void testBucketToRaster_rasterFromValue() { Number bucketValue = 5.0; Number rasterValue = geohashGrid.bucketToRaster("bucket_key", bucketValue); assertEquals(bucketValue, rasterValue); }