}
}
@Test
public void testLatLngWithModifiedBinding() {
Binding binding = new Binding();
// The White House, Washington, DC
binding.setVariable("street", "1600 Pennsylvania Avenue");
binding.setVariable("city", "Washington");
binding.setVariable("state", "DC");
GroovyShell shell = new GroovyShell(binding);
try {
shell.evaluate(new File("src/geocodeV3.groovy"));
assertEquals(38.898,
Double.parseDouble((String) binding.getVariable("lat")),0.01);
assertEquals(-77.037,
Double.parseDouble((String) binding.getVariable("lng")),0.01);
// Greenwich Observatory, Greenwich, England
binding.setVariable("street", "Blackheath Avenue");
binding.setVariable("city","Greenwich");
binding.setVariable("state","UK");
shell.evaluate(new File("src/geocodeV3.groovy"));
assertEquals(51.476,
Double.parseDouble((String) binding.getVariable("lat")),0.01);
assertEquals(0.001,
Double.parseDouble((String) binding.getVariable("lng")),0.01);
} catch (CompilationFailedException | IOException e) {
e.printStackTrace();
}
}