@Test
public void test() throws IOException {

  final DistortionGroupManagement distortionGroupManagement =
      new DistortionGroupManagement(storePluginOptions);
  distortionGroupManagement.retainBestGroups(
      new SimpleFeatureItemWrapperFactory(),
      adapter.getTypeName(),
      index.getName(),
      "b1",
      1);
  final CentroidManagerGeoWave<SimpleFeature> centroidManager =
      new CentroidManagerGeoWave<>(
          storePluginOptions.createDataStore(),
          storePluginOptions.createIndexStore(),
          storePluginOptions.createAdapterStore(),
          new SimpleFeatureItemWrapperFactory(),
          adapter.getTypeName(),
          storePluginOptions.createInternalAdapterStore().getAdapterId(adapter.getTypeName()),
          index.getName(),
          "b1",
          1);
  final List<String> groups = centroidManager.getAllCentroidGroups();
  assertEquals(2, groups.size());
  final boolean groupFound[] = new boolean[2];
  for (final String grpId : groups) {
    final List<AnalyticItemWrapper<SimpleFeature>> items =
        centroidManager.getCentroidsForGroup(grpId);
    assertEquals(2, items.size());
    if ("grp1".equals(grpId)) {
      groupFound[0] = true;
      assertTrue("pearl".equals(items.get(0).getName()) || "roxy".equals(items.get(0).getName()));
    } else if ("grp2".equals(grpId)) {
      groupFound[1] = true;
      assertTrue(
          "chip".equals(items.get(0).getName()) || "bamm-bamm".equals(items.get(0).getName()));
    }
  }
  // each unique group is found?
  int c = 0;
  for (final boolean gf : groupFound) {
    c += (gf ? 1 : 0);
  }
  assertEquals(2, c);
}