Setting up all these mocks requires logic that's almost as complicated as the code under test itself. Could you create a `DummyStorageMetadata` type that you simply pass some constructor arguments, and it does the rest? Then all you'd have is
```
for (int i = 0; i < TOTAL_KEYS; i++) {
  mdList.add(new DummyStorageMetadata(i));
  builder.add("ABCD_" + i);
  if (i == 1000) {
    deleteKeys(builder.build());
    builder = builder2;
  }
}
```
or similar.