@DataProvider(name = "trimmingData")
  public Iterator<Object[]> trimmingData() {
    final AssemblyRegion activeRegion =
        new AssemblyRegion(
            genomeLocParser.createGenomeLoc("1", 1000, 1100), genomeLocParser, 25, header);
    final int length = activeRegion.getExtendedSpan().size();
    final RandomDNA rnd = new RandomDNA(13); // keep it prepoducible by fixing the seed to lucky 13.
    final AssemblyRegionTestDataSet actd =
        new AssemblyRegionTestDataSet(
            10,
            new String(rnd.nextBases(length)),
            new String[] {"Civar:*1T*"},
            new String[0],
            new byte[0],
            new byte[0],
            new byte[0]);

    final List<Haplotype> haplotypes = actd.haplotypeList();
    for (final Haplotype h : haplotypes) h.setGenomeLocation(activeRegion.getExtendedSpan());

    final ReadThreadingGraph rtg = new ReadThreadingGraph(10);
    for (final Haplotype h : haplotypes)
      rtg.addSequence("seq-" + Math.abs(h.hashCode()), h.getBases(), h.isReference());
    final SeqGraph seqGraph = rtg.toSequenceGraph();
    final AssemblyResult ar =
        new AssemblyResult(AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, seqGraph, rtg);
    final Map<Haplotype, AssemblyResult> result = new HashMap<>();
    for (final Haplotype h : haplotypes) result.put(h, ar);
    return Collections.singleton(new Object[] {result, activeRegion}).iterator();
  }
  @DataProvider(name = "assemblyResults")
  public java.util.Iterator<Object[]> assemblyResults() {
    final int size =
        THREE_KS_GRAPH_AND_HAPLOTYPES.length * (1 + TEN_KS_GRAPH_AND_HAPLOTYPES.length);
    final Object[][] result = new Object[size][];

    for (int i = 0; i < THREE_KS_GRAPH_AND_HAPLOTYPES.length; i++) {
      final ReadThreadingGraph rtg =
          new TestingReadThreadingGraph((String) THREE_KS_GRAPH_AND_HAPLOTYPES[i][0]);
      final AssemblyResult ar =
          new AssemblyResult(
              AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, rtg.toSequenceGraph(), rtg);
      final Object[] haplotypeStrings = (Object[]) THREE_KS_GRAPH_AND_HAPLOTYPES[i][1];
      final Haplotype[] haplotypes = new Haplotype[haplotypeStrings.length];
      for (int j = 0; j < haplotypeStrings.length; j++) {
        haplotypes[j] = new Haplotype(((String) haplotypeStrings[j]).getBytes(), j == 0);
        haplotypes[j].setGenomeLocation(
            genomeLocParser.createGenomeLoc("1", 1, haplotypes[j].length() + 1));
      }
      result[i] =
          new Object[] {Collections.singletonList(ar), Arrays.asList(Arrays.asList(haplotypes))};
      for (int j = 0; j < TEN_KS_GRAPH_AND_HAPLOTYPES.length; j++) {
        final ReadThreadingGraph rtg10 =
            new TestingReadThreadingGraph((String) TEN_KS_GRAPH_AND_HAPLOTYPES[j][0]);
        final AssemblyResult ar10 =
            new AssemblyResult(
                AssemblyResult.Status.ASSEMBLED_SOME_VARIATION, rtg10.toSequenceGraph(), rtg10);
        final Object[] haplotypeStrings10 = (Object[]) TEN_KS_GRAPH_AND_HAPLOTYPES[j][1];
        final Haplotype[] haplotype10 = new Haplotype[haplotypeStrings10.length];
        for (int k = 0; k < haplotypeStrings10.length; k++) {
          haplotype10[k] = new Haplotype(((String) haplotypeStrings10[k]).getBytes(), false);
          haplotype10[k].setGenomeLocation(
              genomeLocParser.createGenomeLoc("1", 1, haplotype10[k].length() + 1));
        }

        result[THREE_KS_GRAPH_AND_HAPLOTYPES.length + i * TEN_KS_GRAPH_AND_HAPLOTYPES.length + j] =
            new Object[] {
              Arrays.asList(ar, ar10),
              Arrays.asList(Arrays.asList(haplotypes), Arrays.asList(haplotype10))
            };
      }
    }
    return Arrays.asList(result).iterator();
  }
  @Test
  public void testAddReferenceHaplotype() {

    final Haplotype ref = new Haplotype("ACGT".getBytes(), true);
    ref.setGenomeLocation(genomeLocParser.createGenomeLoc("1", 1, ref.length() + 1));
    final AssemblyResultSet subject = new AssemblyResultSet();

    Assert.assertTrue(subject.add(ref));
    Assert.assertFalse(subject.add(ref));

    Assert.assertEquals(subject.getReferenceHaplotype(), ref);
    Assert.assertEquals(subject.getHaplotypeCount(), 1);
    Assert.assertEquals(subject.getHaplotypeList().size(), 1);
  }