### Question:
Genotype { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((alleleNumbers == null) ? 0 : alleleNumbers.hashCode()); return result; } Genotype(Collection<Integer> alleleNumbers); ImmutableList<Integer> getAlleleNumbers(); int getPloidy(); boolean isDiploid(); boolean isMonoploid(); boolean isHet(); boolean isHomRef(); boolean isHomAlt(); boolean isNotObserved(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); static final int NO_CALL; static final int REF_CALL; }### Answer:
@Test public void testHashCode() { Map<Genotype, String> map = new HashMap<>(); map.put(new Genotype(Arrays.asList(1, 2)), "ONE"); map.put(new Genotype(Arrays.asList(1, 2)), "TWO"); map.put(new Genotype(Arrays.asList(1, 1)), "THREE"); Map<Genotype, String> expected = new HashMap<>(); expected.put(new Genotype(Arrays.asList(1, 2)), "TWO"); expected.put(new Genotype(Arrays.asList(1, 1)), "THREE"); assertEquals(expected, map); }