DefaultCustomerService implements CustomerService { public List<Customer> findCustomersByFirstNames(Collection<String> firstNames) { return repository.findByFirstNameIn(firstNames); } 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 testLoadingCustomersByFirstNames() { createCustomer("Milad", "Naseri", null); final Customer customer = createCustomer("Mateusz", "Stefek", null); final List<Customer> list = service.findCustomersByFirstNames(Collections.singleton("Mateusz")); assertThat(list, is(notNullValue())); assertThat(list, hasSize(1)); assertThat(list.get(0), is(customer)); }