@Test
  public void generateStringKeys_whenRemote_equalDistributionOverPartitions() {
    Map<Integer, Integer> countsPerPartition = new HashMap<Integer, Integer>();
    for (Partition partition : instance.getPartitionService().getPartitions()) {
      if (!partition.getOwner().localMember()) {
        countsPerPartition.put(partition.getPartitionId(), 0);
      }
    }

    int keysPerPartition = 4;
    int keyCount = countsPerPartition.size() * keysPerPartition;
    String[] keys = KeyUtils.generateStringKeys("foo", keyCount, KeyLocality.REMOTE, instance);

    assertEquals(keyCount, keys.length);

    for (String key : keys) {
      Partition partition = instance.getPartitionService().getPartition(key);
      Integer count = countsPerPartition.get(partition.getPartitionId());
      assertNotNull(count);
      countsPerPartition.put(partition.getPartitionId(), count + 1);
    }

    LOGGER.info(countsPerPartition);
    for (int count : countsPerPartition.values()) {
      assertEquals(keysPerPartition, count);
    }
  }
  @Test
  public void generateStringKeys_whenRandom_equalDistributionOverPartitions() {
    int keysPerPartition = 4;
    int keyCount = keysPerPartition * PARTITION_COUNT;
    String[] keys = KeyUtils.generateStringKeys("foo", keyCount, KeyLocality.RANDOM, instance);

    assertEquals(keyCount, keys.length);

    int[] countPerPartition = new int[PARTITION_COUNT];
    for (String key : keys) {
      Partition partition = instance.getPartitionService().getPartition(key);
      countPerPartition[partition.getPartitionId()]++;
    }

    for (int count : countPerPartition) {
      assertEquals(keysPerPartition, count);
    }
  }