QueryDslCustomerRepository implements CustomerRepository { @Override @Transactional(readOnly = true) public Customer findByEmailAddress(EmailAddress emailAddress) { if (emailAddress == null) { return null; } return findOne(qCustomer.emailAddress.eq(emailAddress.toString())); }  @Autowired void setDataSource(DataSource dataSource); @Override @Transactional(readOnly = true) Customer findById(Long id); @Override @Transactional(readOnly = true) List<Customer> findAll(); @Override @Transactional(readOnly = true) Customer findByEmailAddress(EmailAddress emailAddress); @Override void save(final Customer customer); @Override void delete(final Customer customer);  }
@Test public void testFindByEmail() { Customer result = repository.findByEmailAddress(new EmailAddress("bob@doe.com")); assertThat(result, is(notNullValue())); assertThat(result.getFirstName(), is("Bob")); }