DefaultQueryByExampleExecutor implements DataStoreAware, RepositoryConfigurationAware, RepositoryMetadataAware,
                   RepositoryFactoryConfigurationAware { public boolean exists(Example example) { return count(example) > 0; } DefaultQueryByExampleExecutor(); Object findOne(Example example); Iterable findAll(Example example); Iterable findAll(Example example, Sort sort); Page findAll(Example example, Pageable pageable); long count(Example example); boolean exists(Example example); @Override void setDataStore(DataStore dataStore); @Override void setRepositoryConfiguration(RepositoryConfiguration repositoryConfiguration); @Override void setRepositoryMetadata(RepositoryMetadata repositoryMetadata); @Override void setRepositoryFactoryConfiguration(RepositoryFactoryConfiguration configuration);  }
@Test public void testExists() { final Person probe = new Person().setAddress(new Address().setState(new State().setName("ehe"))); final ExampleMatcher matching = ExampleMatcher.matching() .withMatcher("address.state.name", ExampleMatcher.GenericPropertyMatchers.contains()); final Example<Person> example = Example.of(probe, matching); final boolean exists = executor.exists(example); assertThat(exists, is(true)); }
@Test public void testWithNullsKept() { final Person probe = new Person().setAddress(new Address().setState(new State().setName("ehe"))); final ExampleMatcher matching = ExampleMatcher.matching() .withMatcher("address.state.name", ExampleMatcher.GenericPropertyMatchers.contains()) .withIncludeNullValues(); final Example<Person> example = Example.of(probe, matching); final boolean exists = executor.exists(example); assertThat(exists, is(false)); }