Restaurant implements Model, NameProtocol, AddressProtocol { public static ModelCollectionQuery<Restaurant> within10km(Address address) { return new Within10Km(address); } protected  Restaurant(Repository repository, UUID id); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); static Optional<Restaurant> lookup(Repository repository, UUID id); static ModelCollectionQuery<Restaurant> within10km(Address address); static ModelCollectionQuery<Restaurant> openAt(Date date); static Collection<Restaurant> query(Repository repository, ModelCollectionQuery<Restaurant> query); Map<Integer, List<OpeningHours>> openingHours(); Collection<MenuItem> menu();  }
@Test @SneakyThrows public void within10Km() { Address closeBy = new Address("375 Water St, Vancouver, BC", "Canada", "Vancouver", "V6B 5C6", 49.2849885, -123.1107973); Address outside = new Address("810 Quayside Dr, New Westminster, BC", "Canada", "New Westminster", "V3M 6B9", 49.200145, -122.911488); Restaurant kyzock = repository.publish(kyzockRegistration()).get(); Collection<Restaurant> restaurants = Restaurant.query(repository, within10km(closeBy)); assertEquals(restaurants.size(), 1); assertTrue(restaurants.contains(kyzock)); restaurants = Restaurant.query(repository, within10km(outside)); assertEquals(restaurants.size(), 0); }