NearbyStopsBeanServiceImpl implements NearbyStopsBeanService { @Cacheable public List<AgencyAndId> getNearbyStops( @CacheableArgument(keyProperty = "id") StopBean stopBean, double radius) { CoordinateBounds bounds = SphericalGeometryLibrary.bounds( stopBean.getLat(), stopBean.getLon(), radius); List<AgencyAndId> ids = _geospatialBeanService.getStopsByBounds(bounds); List<AgencyAndId> excludingSource = new ArrayList<AgencyAndId>(); for (AgencyAndId id : ids) { if (!ApplicationBeanLibrary.getId(id).equals(stopBean.getId())) excludingSource.add(id); } return excludingSource; }  @Autowired void setGeospatialBeanService(
      GeospatialBeanService geospatialBeanService); @Cacheable List<AgencyAndId> getNearbyStops(
      @CacheableArgument(keyProperty = "id") StopBean stopBean, double radius);  }
@Test public void test() { AgencyAndId stopIdA = new AgencyAndId("1", "stopA"); AgencyAndId stopIdB = new AgencyAndId("1", "stopB"); StopBean stop = new StopBean(); stop.setId(AgencyAndIdLibrary.convertToString(stopIdA)); stop.setLat(47.0); stop.setLon(-122.0); List<AgencyAndId> stopIds = new ArrayList<AgencyAndId>(); stopIds.add(stopIdA); stopIds.add(stopIdB); CoordinateBounds bounds = SphericalGeometryLibrary.bounds(stop.getLat(), stop.getLon(), 400); Mockito.when(_geoBeanService.getStopsByBounds(bounds)).thenReturn(stopIds); List<AgencyAndId> nearby = _service.getNearbyStops(stop, 400); assertEquals(1, nearby.size()); assertTrue(nearby.contains(stopIdB)); }