### Question:
VariantReferenceBlockCreatorTask implements Task<Variant, Variant> { @Override public List<Variant> apply(List<Variant> list) throws Exception { List<Variant> fixedList = new ArrayList<>(((int) (list.size() * 1.2))); for (Variant variant : list) { if (chromosome == null) { init(variant); fixedList.addAll(createContigFirstBlock()); } else { if (!variant.getChromosome().equals(chromosome)) { fixedList.addAll(createContigLastBlock()); init(variant); fixedList.addAll(createContigFirstBlock()); } else { if (variant.getStart() != position) { if ((end + 1) < variant.getStart()) { fixedList.add(createRefBlock(chromosome, end + 1, variant.getStart() - 1)); } position = variant.getStart(); end = variant.getEnd(); } else { end = Math.max(variant.getEnd(), end); } } } fixedList.add(variant); } return fixedList; } VariantReferenceBlockCreatorTask();  VariantReferenceBlockCreatorTask(Map<String, Integer> contigs);  VariantReferenceBlockCreatorTask(VariantFileHeader fileHeader);  VariantReferenceBlockCreatorTask(VCFHeader fileHeader); @Override void pre(); @Override List<Variant> apply(List<Variant> list); @Override List<Variant> drain();  }### Answer:
@Test public void testFillBlocks() throws Exception { assertEquals( asList("1:1-99:N:.", "1:100:A:C", "1:101-119:N:.", "1:120:A:C", "1:121-10000:N:."), apply( "1:100:A:C", "1:120:A:C")); assertEquals( asList("1:1-99:N:.", "1:100:A:CTG", "1:100:A:C", "1:101-119:N:.", "1:120:A:C", "1:121-10000:N:."), apply( "1:100:A:CTG", "1:100:A:C", "1:120:A:C")); assertEquals( asList("1:1-99:N:.", "1:100:ATG:C", "1:100:A:C", "1:103-119:N:.", "1:120:A:C", "1:121-10000:N:."), apply( "1:100:ATG:C", "1:100:A:C", "1:120:A:C")); assertEquals( asList("1:1-99:N:.", "1:100:A:C", "1:100:ATG:C", "1:103-119:N:.", "1:120:A:C", "1:121-10000:N:."), apply( "1:100:A:C", "1:100:ATG:C", "1:120:A:C")); }