IntegerMapGenotype extends IntegerGenotype implements MapGenotype<K, Integer> { public void init(Random random) { super.init(random, list.size()); } 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();  }
@Test(expected = UnsupportedOperationException.class) public void testForbiddenInit() { Random rand = new Random(); int[] lowerBounds = { 1, 2, 3 }; int[] upperBounds = { 2, 3, 4 }; Bounds<Integer> bounds = new IntegerBounds(lowerBounds, upperBounds); MockObject mockup1 = new MockObject(1.0, 1); MockObject mockup2 = new MockObject(2.0, 2); MockObject mockup3 = new MockObject(3.0, 3); List<MockObject> inputList = new ArrayList<>(); inputList.add(mockup1); inputList.add(mockup2); inputList.add(mockup3); IntegerMapGenotype<MockObject> integerMapGenotype = new IntegerMapGenotype<>(inputList, bounds); integerMapGenotype.init(rand, 3); }