DefaultJpaRepository extends CrudRepositorySupport { public Object getOne(Object key) { if (getDataStore().hasKey(key)) { log.info("Returning entity for key " + key); return getDataStore().retrieve(key); } log.info("No entity was found with key " + key); return null; }  void flush(); Iterable deleteInBatch(Iterable entities); Iterable deleteAllInBatch(); Object getOne(Object key); Object saveAndFlush(Object entity);  }
@Test public void testGetOne() { final String key = "1234"; assertThat(repository.getOne(key), is(nullValue())); final Person person = new Person(); dataStore.save("1234", person); assertThat(repository.getOne(key), Matchers.is(person)); }