### Question:
HapsGenotypeData extends AbstractRandomAccessGenotypeData implements SampleVariantsProvider { @Override public Iterator<GeneticVariant> iterator() { return variants.iterator(); } HapsGenotypeData(String path);  HapsGenotypeData(File hapsFile, File sampleFile);  HapsGenotypeData(File hapsFile, File sampleFile, int cacheSize);  HapsGenotypeData(File hapsFile, File sampleFile, String forceSeqName);  HapsGenotypeData(File hapsFile, File sampleFile, int cacheSize, String forceSeqName); @Override Iterable<Sequence> getSequences(); @Override List<Sample> getSamples(); @Override Map<String, Annotation> getVariantAnnotationsMap(); @Override Map<String, SampleAnnotation> getSampleAnnotationsMap(); @Override synchronized List<Alleles> getSampleVariants(GeneticVariant variant); @Override synchronized List<Boolean> getSamplePhasing(GeneticVariant variant); @Override boolean arePhasedProbabilitiesPresent(GeneticVariant variant); @Override int cacheSize(); @Override int getSampleVariantProviderUniqueId(); @Override byte[] getSampleCalledDosage(GeneticVariant variant); @Override float[] getSampleDosage(GeneticVariant variant); @Override void close(); @Override Iterator<GeneticVariant> iterator(); @Override List<String> getSeqNames(); @Override Iterable<GeneticVariant> getVariantsByPos(String seqName, int startPos); @Override Iterable<GeneticVariant> getSequenceGeneticVariants(String seqName); @Override Iterable<GeneticVariant> getVariantsByRange(String seqName, int rangeStart, int rangeEnd); @Override boolean isOnlyContaingSaveProbabilityGenotypes(); @Override float[][] getSampleProbilities(GeneticVariant variant); @Override double[][] getSampleProbabilitiesComplex(GeneticVariant variant); @Override double[][][] getSampleProbabilitiesPhased(GeneticVariant variant); @Override FixedSizeIterable<GenotypeRecord> getSampleGenotypeRecords(GeneticVariant variant);  }### Answer:
@Test public void iterator() { Iterator<GeneticVariant> it = genotypeData.iterator(); assertNotNull(it); GeneticVariant var = it.next(); assertNotNull(var); assertEquals(var.getPrimaryVariantId(), "SNP1"); assertEquals(var.getSequenceName(), "7"); assertEquals(var.getStartPos(), 123); assertEquals(var.getAlleleCount(), 2); assertEquals(var.getAllIds(), Arrays.asList("SNP1")); assertEquals(var.getVariantAlleles(), Alleles.createBasedOnChars('A', 'G')); assertEquals( var.getSampleVariants(), Arrays.asList(Alleles.createBasedOnChars('A', 'A'), Alleles.createBasedOnChars('G', 'A'), Alleles.createBasedOnChars('A', 'A'), Alleles.createBasedOnChars('G', 'G'))); assertEquals(var.getMinorAllele(), Allele.G); assertEquals(var.getMinorAlleleFrequency(), 0.375, 0.001); assertEquals(Utils.iteratorToList(genotypeData.iterator()).size(), 4); }