DefaultCustomerService implements CustomerService { public List<Customer> findCustomersByBirthday(Date from, Date to) { return repository.findByBirthdayBetween(from, to); } DefaultCustomerService(CustomerRepository repository); long register(String firstName, String lastName, Date birthday); Customer findCustomer(long id); List<Customer> findCustomersByBirthday(Date from, Date to); List<Customer> findCustomersByName(String firstName, String lastName); List<Customer> findCustomersByFirstNames(Collection<String> firstNames); @Override List<Customer> findByFirstNamePart(final String part);  }
@Test public void testLoadingCustomersByBirthday() { final Customer first = createCustomer("Milad", "Naseri", date(1988, 1, 1)); final Customer second = createCustomer("Zohreh", "Sadeghi", date(1989, 9, 22)); createCustomer("Hassan", "Naseri", date(1962, 4, 15)); final List<Customer> list = service.findCustomersByBirthday(date(1988, 1, 1), date(1989, 12, 28)); assertThat(list, is(notNullValue())); assertThat(list, hasSize(2)); assertThat(list, containsInAnyOrder(first, second)); }