@Test(expected = IllegalArgumentException.class) public void testGetValueMissingKey() { int lower = 1; int upper = 2; MockObject m1 = new MockObject(1.0, 1); List<MockObject> list = new ArrayList<>(); list.add(m1); IntegerMapGenotype<MockObject> geno = new IntegerMapGenotype<>(list, lower, upper); geno.getValue(new MockObject(1.0, 2)); }
@Override public Integer getValue(K key) { if (!containsKey(key)) { throw new IllegalArgumentException(MapGenotype.ERROR_MESSAGE_INVALID_KEY); } int i = list.indexOf(key); return get(i); }
IntegerMapGenotype extends IntegerGenotype implements MapGenotype<K, Integer> { @Override public Integer getValue(K key) { if (!containsKey(key)) { throw new IllegalArgumentException(MapGenotype.ERROR_MESSAGE_INVALID_KEY); } int i = list.indexOf(key); return get(i); } }
IntegerMapGenotype extends IntegerGenotype implements MapGenotype<K, Integer> { @Override public Integer getValue(K key) { if (!containsKey(key)) { throw new IllegalArgumentException(MapGenotype.ERROR_MESSAGE_INVALID_KEY); } int i = list.indexOf(key); return get(i); } IntegerMapGenotype(List<K> list, Bounds<Integer> bounds);  IntegerMapGenotype(List<K> list, int lowerBound, int upperBound); }
IntegerMapGenotype extends IntegerGenotype implements MapGenotype<K, Integer> { @Override public Integer getValue(K key) { if (!containsKey(key)) { throw new IllegalArgumentException(MapGenotype.ERROR_MESSAGE_INVALID_KEY); } int i = list.indexOf(key); return get(i); } IntegerMapGenotype(List<K> list, Bounds<Integer> bounds);  IntegerMapGenotype(List<K> list, int lowerBound, int upperBound); void init(Random random); @Override void init(Random random, int n); @Override boolean containsKey(K key); @Override Integer getValue(K key); @Override void setValue(K key, Integer value); @Override @SuppressWarnings({ "unchecked", "rawtypes" }) G newInstance(); @Override String toString(); @Override int getIndexOf(K key); @Override Collection<K> getKeys(); }
IntegerMapGenotype extends IntegerGenotype implements MapGenotype<K, Integer> { @Override public Integer getValue(K key) { if (!containsKey(key)) { throw new IllegalArgumentException(MapGenotype.ERROR_MESSAGE_INVALID_KEY); } int i = list.indexOf(key); return get(i); } IntegerMapGenotype(List<K> list, Bounds<Integer> bounds);  IntegerMapGenotype(List<K> list, int lowerBound, int upperBound); void init(Random random); @Override void init(Random random, int n); @Override boolean containsKey(K key); @Override Integer getValue(K key); @Override void setValue(K key, Integer value); @Override @SuppressWarnings({ "unchecked", "rawtypes" }) G newInstance(); @Override String toString(); @Override int getIndexOf(K key); @Override Collection<K> getKeys();  }