ArrayBasedLongToInternalIntFixedLengthBiMap implements LongToInternalIntBiMap { @Override public long getKey(int value) { if (value < 0 || value >= array.length()) { throw new IndexOutOfBoundsException("index " + value); } return array.get(value); } ArrayBasedLongToInternalIntFixedLengthBiMap(
      int capacity,
      double loadFactor,
      int defaultGetReturnValue,
      long defaultGetKeyReturnValue,
      StatsReceiver statsReceiver); @Override int get(long key); @Override int put(long key); @Override long getKey(int value); @Override void clear();  }
@Test public void testGetKeyWithNegative() { NullStatsReceiver nullStatsReceiver = new NullStatsReceiver(); ArrayBasedLongToInternalIntFixedLengthBiMap arrayBasedLongToInternalIntFixedLengthBiMap = new ArrayBasedLongToInternalIntFixedLengthBiMap((-1768), 0.0, 14, (-1768), nullStatsReceiver); try { arrayBasedLongToInternalIntFixedLengthBiMap.getKey((-1768)); fail("Expecting exception: IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { assertEquals(ArrayBasedLongToInternalIntFixedLengthBiMap.class.getName(), e.getStackTrace()[0].getClassName()); } }
@Test public void testGetKeyThrowsIndexOutOfBoundsException() { ArrayBasedLongToInternalIntFixedLengthBiMap arrayBasedLongToInternalIntFixedLengthBiMap = new ArrayBasedLongToInternalIntFixedLengthBiMap(0, 0, 22, 0L, new NullStatsReceiver()); try { arrayBasedLongToInternalIntFixedLengthBiMap.getKey(722); fail("Expecting exception: IndexOutOfBoundsException"); } catch (IndexOutOfBoundsException e) { assertEquals(ArrayBasedLongToInternalIntFixedLengthBiMap.class.getName(), e.getStackTrace()[0].getClassName()); } }