@Test
  public void testRandomMap() {
    final ObjIdMap map = new ObjIdMap();
    final int size = 1000;

    // ----------------------
    // This test naively assumed that a list of 1000 ints or 1000 longs would
    // yield 1000 distinct values. This has been rewritten to ensure
    // this invariant...
    // ----------------------
    Random random = new Random();

    // Loop until we have 1000 keys. This addresses the slight
    // possibility of duplicates...
    HashSet<Integer> keySet = new HashSet<>();
    while (keySet.size() != size) {
      int key = Math.abs(random.nextInt());
      keySet.add(key);
    }

    // Loop until we have 1000 values
    HashSet<Long> valueSet = new HashSet<>();
    while (valueSet.size() != size) {
      long value = Math.abs(random.nextLong());
      valueSet.add(value);
    }

    Iterator<Integer> keyIt = keySet.iterator();
    Iterator<Long> valueIt = valueSet.iterator();
    int[] keys = new int[size];
    Long[] values = new Long[size];
    for (int i = 0; i < size; i++) {
      keys[i] = keyIt.next();
      values[i] = valueIt.next();
    }

    // ----------------------
    // Now back to your regularly scheduled program...
    // ----------------------

    // Now populate the map...
    for (int i = 0; i < size; i++) {
      map.put(keys[i], values[i]);
    }
    assertEquals("Map is not correct size", size, map.size());

    for (int i = 0; i < size; i++) {
      int key = keys[i];
      assertTrue("Map does not contain key", map.containsKey(key));
      assertEquals("Map has wrong value for key", values[i], map.get(key));
    }

    Object[] valueArray = map.values();
    assertEquals("Value array for map is wrong size", size, valueArray.length);

    for (int i = 0; i < size; i++) {
      boolean found = false;
      int key = keys[i];
      Object value = values[i];
      for (final Object o : valueArray) {
        if (o.equals(value)) {
          found = true;
          break;
        }
      }

      assertTrue("Didn't find " + key, found);
    }
  }
This class tests the functionality of the {@link ObjIdMap} class.
geode-core/src/test/java/org/apache/geode/internal/ObjIdMapJUnitTest.java