LatLongEnhancer { public void addLatLong(Map<String, Object> geocodingResult) { for (LatLongConfig config : this.latLongConfigs) { MapPoint nyspPoint = getNyspPoint(geocodingResult,config); if (nyspPoint.isValid()) { MapPoint latLongPoint = this.transformer.transform(nyspPoint.getX(), nyspPoint.getY()); geocodingResult.put(config.getLongName(), latLongPoint.getX()); geocodingResult.put(config.getLatName(), latLongPoint.getY()); } } }  void addLatLong(Map<String, Object> geocodingResult); MapPoint getNyspPoint(Map<String, Object> geocodingResult, LatLongConfig config); List<ItemDocumentation> getItemDocumentation(); Transformer getTransformer(); void setTransformer(Transformer transformer); List<LatLongConfig> getLatLongConfigs(); void setLatLongConfigs(List<LatLongConfig> latLongConfigs); static final LatLongConfig DEFAULT_LATLONG_CONFIG; static final LatLongConfig DEFAULT_LATLONG_INTERNAL_LABEL_CONFIG; static final Transformer DEFAULT_TRANSFORMER; static final List<LatLongConfig> DEFAULT_CONFIGS; }
@Test public void testAddLatLong_invalidPointAvailable() { this.geocodingResult.put(OutputParam.XCOORD, this.xCoord); this.latLongEnhancer.addLatLong(geocodingResult); assertFalse(geocodingResult.containsKey(LatLongEnhancer.DEFAULT_LATLONG_CONFIG.getLatName())); assertFalse(geocodingResult.containsKey(LatLongEnhancer.DEFAULT_LATLONG_CONFIG.getLongName())); }
@Test public void testAddLatLong_validPointAvailable() { this.geocodingResult.put(OutputParam.XCOORD, this.xCoord); this.geocodingResult.put(OutputParam.YCOORD, this.yCoord); this.latLongEnhancer.addLatLong(geocodingResult); assertEquals(this.expectedLat, (double)geocodingResult.get(LatLongEnhancer.DEFAULT_LATLONG_CONFIG.getLatName())); assertEquals(this.expectedLong, (double)geocodingResult.get(LatLongEnhancer.DEFAULT_LATLONG_CONFIG.getLongName())); }