DefaultLDAPClientService extends AbstractLDAPService<Client> implements ClientService { @Override public Client findByName(final String name) { return findByName(Client.class, name).map(this::initSchema).findFirst().orElse(null); } DefaultLDAPClientService(RealmService realmService); @Override Set<Client> findByHwAddress(String hwAddressString); @Override Set<ClientMetaData> findByLocation(String locationName); @Cacheable("clientMetaData") @CacheEvict(value="clientMetaData", allEntries=true) Set findAllClientMetaData(); @Override Set<Client> findAll(); @Override Client getDefaultClient(); @Override Client findByName(final String name); @Override void save(Client client);  }
@Test public void testFindByName() throws Exception { final Client client = new Client(); client.setName("My Simple Client"); clientService.save(client); final Client client2 = new Client(); client2.setName("Another Simple Client"); clientService.save(client2); final Client result = clientService.findByName("My Simple Client"); assertNotNull(result); assertEquals("My Simple Client", result.getName()); assertNotNull(result.getDn()); }