public int merge(final int key, final int value, final IntIntFunction remappingFunction)
    {
        requireNonNull(remappingFunction);
        final int missingValue = this.missingValue;
        if (missingValue == value)
        {
            throw new IllegalArgumentException("cannot accept missingValue");
        }
        final int[] entries = this.entries;
        @DoNotSub final int mask = entries.length - 1;
        @DoNotSub int index = Hashing.evenHash(key, mask);

        int oldValue;
        while (missingValue != (oldValue = entries[index + 1]))
        {
            if (key == entries[index])
            {
                break;
            }

            index = next(index, mask);
        }

        final int newValue = missingValue == oldValue ? value : remappingFunction.apply(oldValue, value);
        if (missingValue != newValue)
        {
            entries[index + 1] = newValue;
            if (oldValue == missingValue)
            {
                entries[index] = key;
                size++;
                increaseCapacity();
            }
        }
        else
        {
            entries[index + 1] = missingValue;
            size--;
            compactChain(index);
        }

        return newValue;
    }
@Test
    void mergeThrowsIllegalArgumentExceptionIfValueIsMissingValue()
    {
        final int missingValue = 42;
        final Int2IntHashMap map = new Int2IntHashMap(missingValue);
        final int key = -9;
        final IntIntFunction remappingFunction = mock(IntIntFunction.class);

        final IllegalArgumentException exception =
            assertThrowsExactly(IllegalArgumentException.class, () -> map.merge(key, missingValue, remappingFunction));
        assertEquals("cannot accept missingValue", exception.getMessage());
    }