SelectMapGenotype extends IntegerGenotype implements MapGenotype<K, V> { @Override public int getIndexOf(K key) { if (!containsKey(key)) { throw new IllegalArgumentException(MapGenotype.ERROR_MESSAGE_INVALID_KEY); } return keys.indexOf(key); } SelectMapGenotype(List<K> keys, Map<K, List<V>> values);  SelectMapGenotype(List<K> keys, List<V> values); void init(Random random); @Override void init(Random random, int n); @Override boolean containsKey(K key); @Override int getIndexOf(K key); @Override V getValue(K key); @Override void setValue(K key, V value); @Override @SuppressWarnings({ "unchecked", "rawtypes" }) G newInstance(); @Override String toString(); @Override Collection<K> getKeys();  }
@Test(expected = IllegalArgumentException.class) public void testInvalidKey() { Inputs inputs = new Inputs(); SelectMapGenotype<Integer, Integer> geno = new SelectMapGenotype<>(inputs.list, inputs.map); geno.getIndexOf(4); }