CloudDatastoreBackend extends AbstractDatabaseBackend { @Override public void delete(Model model) { Datastore datastore = getService(); KeyFactory keyFactory = datastore.newKeyFactory().setKind(model.getClass().getSimpleName()); Key key = keyFactory.newKey(model.getDBId()); datastore.delete(key); }  @Override List<Model> getAll(Class modelClass); @Override Model get(Class modelClass, String objectId); void save(Model model); @Override void delete(Model model); @Override int deleteExpiredItems(Class modelClass, String field, Long cutoffTime, Integer numItems); @Override void initializeDatabase(); @Override CheckResult checkConnection();  }
@Test public void testDelete() { Datastore datastore = getService(); KeyFactory keyFactory = datastore.newKeyFactory().setKind("Foo"); Key key = keyFactory.newKey("myid"); Entity.Builder builder = Entity.newBuilder(key); builder.set("longVal", 1564094282994L); builder.set("byteVal", Blob.copyFrom("abcd".getBytes())); Entity entity = builder.build(); datastore.put(entity); Foo foo = new Foo("myid", null, null, List.of("hello", "hi")); CloudDatastoreBackend backend = new CloudDatastoreBackend(); backend.delete(foo); keyFactory = datastore.newKeyFactory().setKind("Foo"); key = keyFactory.newKey("myid"); entity = datastore.get(key); assertNull(entity); }