@Override
  public void cleanupAll() throws DatastoreResourceManagerException {
    try {
      datastore.delete(keys.toArray(new Key[0]));
    } catch (Exception e) {
      throw new DatastoreResourceManagerException("Error cleaning up resources", e);
    }
    keys.clear();
  }
@Test
  public void testCleanupAll() {
    // Prepare test data
    Key key = datastoreMock.newKeyFactory().newKey(1L);
    resourceManager.insert(
        "test_kind", Collections.singletonMap(1L, Entity.newBuilder(key).build()));

    // Execute the method under test
    // Calling twice to assert that the key is just deleted once
    resourceManager.cleanupAll();
    resourceManager.cleanupAll();

    // Verify that the Datastore delete method was called with the correct key
    verify(datastoreMock, times(1)).delete(key);
  }