Program: 30607
Project: 30607
Buggy source:
@Test public void testScatter() throws IOException {
  final File scatterDir=IoUtil.createTempDir("String_Node_Str","String_Node_Str");
  try {
    final File listToScatter=new File(TEST_DATA_DIR,"String_Node_Str");
    final IntervalList gold=IntervalList.fromFile(listToScatter);
    Assert.assertEquals(gold.getUniqueBaseCount(),200,"String_Node_Str");
    final File singleFileOutput=File.createTempFile("String_Node_Str","String_Node_Str");
    singleFileOutput.deleteOnExit();
    int result=new IntervalListTools().instanceMain(new String[]{"String_Node_Str" + listToScatter.getAbsolutePath(),"String_Node_Str" + singleFileOutput.getAbsolutePath(),"String_Node_Str" + 1});
    Assert.assertEquals(result,0);
    final IntervalList single=IntervalList.fromFile(singleFileOutput);
    Assert.assertEquals(gold.size(),single.size());
    Assert.assertEquals(gold.getUniqueBaseCount(),single.getUniqueBaseCount());
    result=new IntervalListTools().instanceMain(new String[]{"String_Node_Str" + listToScatter.getAbsolutePath(),"String_Node_Str" + scatterDir.getAbsolutePath(),"String_Node_Str" + 2});
    Assert.assertEquals(result,0);
    Assert.assertEquals(scatterDir.listFiles(new FilenameFilter(){
      public boolean accept(      File file,      String s){
        return s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str");
      }
    }
).length,2,"String_Node_Str");
    IntervalList lists[]=getIntervalLists(scatterDir,2);
    Assert.assertEquals(lists[0].size(),2);
    Assert.assertEquals(lists[0].getIntervals().get(1).length(),1,"String_Node_Str");
    Assert.assertEquals(lists[0].getUniqueBaseCount(),100,"String_Node_Str");
    final IntervalList second=IntervalList.fromFile(IntervalListTools.getScatteredFileName(scatterDir,2,1));
    Assert.assertEquals(lists[1].getUniqueBaseCount(),100,"String_Node_Str");
    result=new IntervalListTools().instanceMain(new String[]{"String_Node_Str" + listToScatter.getAbsolutePath(),"String_Node_Str" + scatterDir.getAbsolutePath(),"String_Node_Str" + 4});
    Assert.assertEquals(result,0);
    Assert.assertEquals(scatterDir.listFiles(new FilenameFilter(){
      public boolean accept(      File file,      String s){
        return s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str");
      }
    }
).length,4,"String_Node_Str");
    lists=getIntervalLists(scatterDir,4);
    Assert.assertEquals(lists[0].size(),1);
    Assert.assertEquals(lists[1].size(),2);
    Assert.assertEquals(lists[2].size(),2);
    Assert.assertEquals(lists[3].size(),1);
    Assert.assertEquals(lists[3].getIntervals().get(0).getStart(),30200);
    Assert.assertEquals(lists[0].getUniqueBaseCount() + lists[1].getUniqueBaseCount() + lists[2].getUniqueBaseCount()+ lists[3].getUniqueBaseCount(),200);
  }
  finally {
    TestUtil.recursiveDelete(scatterDir);
  }
}

Fixed version (ground truth):
@Test public void testScatter() throws IOException {
  final File scatterDir=IoUtil.createTempDir("String_Node_Str","String_Node_Str");
  try {
    final File listToScatter=new File(TEST_DATA_DIR,"String_Node_Str");
    final IntervalList gold=IntervalList.fromFile(listToScatter);
    Assert.assertEquals(gold.getUniqueBaseCount(),200,"String_Node_Str");
    final File singleFileOutput=File.createTempFile("String_Node_Str","String_Node_Str");
    singleFileOutput.deleteOnExit();
    int result=new IntervalListTools().instanceMain(new String[]{"String_Node_Str" + listToScatter.getAbsolutePath(),"String_Node_Str" + singleFileOutput.getAbsolutePath(),"String_Node_Str" + 1});
    Assert.assertEquals(result,0);
    final IntervalList single=IntervalList.fromFile(singleFileOutput);
    Assert.assertEquals(gold.size(),single.size());
    Assert.assertEquals(gold.getUniqueBaseCount(),single.getUniqueBaseCount());
    result=new IntervalListTools().instanceMain(new String[]{"String_Node_Str" + listToScatter.getAbsolutePath(),"String_Node_Str" + scatterDir.getAbsolutePath(),"String_Node_Str" + 2});
    Assert.assertEquals(result,0);
    Assert.assertEquals(scatterDir.listFiles(new FilenameFilter(){
      public boolean accept(      File file,      String s){
        return s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str");
      }
    }
).length,2,"String_Node_Str");
    IntervalList lists[]=getIntervalLists(scatterDir,2);
    Assert.assertEquals(lists[0].size(),2);
    Assert.assertEquals(lists[0].getIntervals().get(1).length(),1,"String_Node_Str");
    Assert.assertEquals(lists[0].getUniqueBaseCount(),100,"String_Node_Str");
    final IntervalList second=IntervalList.fromFile(IntervalListTools.getScatteredFileName(scatterDir,2,1));
    Assert.assertEquals(lists[1].getUniqueBaseCount(),100,"String_Node_Str");
    result=new IntervalListTools().instanceMain(new String[]{"String_Node_Str" + listToScatter.getAbsolutePath(),"String_Node_Str" + scatterDir.getAbsolutePath(),"String_Node_Str" + 4});
    Assert.assertEquals(result,0);
    Assert.assertEquals(scatterDir.listFiles(new FilenameFilter(){
      public boolean accept(      File file,      String s){
        return s.startsWith("String_Node_Str") && s.endsWith("String_Node_Str");
      }
    }
).length,4,"String_Node_Str");
    lists=getIntervalLists(scatterDir,4);
    Assert.assertEquals(lists[0].size(),1);
    Assert.assertEquals(lists[1].size(),2);
    Assert.assertEquals(lists[2].size(),2);
    Assert.assertEquals(lists[3].size(),1);
    Assert.assertEquals(lists[3].getIntervals().get(0).getStart(),30200);
    Assert.assertEquals(lists[0].getUniqueBaseCount() + lists[1].getUniqueBaseCount() + lists[2].getUniqueBaseCount()+ lists[3].getUniqueBaseCount(),200);
    result=new IntervalListTools().instanceMain(new String[]{"String_Node_Str" + listToScatter.getAbsolutePath(),"String_Node_Str" + scatterDir.getAbsolutePath(),"String_Node_Str" + 5});
    Assert.assertEquals(result,0);
    lists=getIntervalLists(scatterDir,5);
    Assert.assertEquals(lists[0].size(),1);
    Assert.assertEquals(lists[1].size(),1);
    Assert.assertEquals(lists[2].size(),2);
    Assert.assertEquals(lists[3].size(),2);
    Assert.assertEquals(lists[4].size(),1);
    Assert.assertEquals(lists[0].getUniqueBaseCount() + lists[1].getUniqueBaseCount() + lists[2].getUniqueBaseCount()+ lists[3].getUniqueBaseCount()+ lists[4].getUniqueBaseCount(),200);
  }
  finally {
    TestUtil.recursiveDelete(scatterDir);
  }
}