IntegerMapGenotype extends IntegerGenotype implements MapGenotype<K, Integer> { @Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("["); for (int i = 0; i < size(); i++) { K key = list.get(i); int value = this.get(i); stringBuilder.append(key + "=" + value + ";"); } stringBuilder.append("]"); return stringBuilder.toString(); } 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 public void testToString() { Random rand = new Random(); int[] lowerBounds = { 1, 2, 3 }; int[] upperBounds = { 1, 2, 3 }; 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); assertEquals("[mock=1;mock=2;mock=3;]", integerMapGenotype.toString()); }