Program: 28804
Project: 28804
Buggy source:
@Test public void recursiveReplacementTest() throws Exception {
  final String DIR="String_Node_Str";
  final String FILE_A_PREFIX=DIR;
  final String FILE_A_NAME="String_Node_Str";
  final String FILE_B_PREFIX=DIR;
  final String FILE_B_NAME="String_Node_Str";
  final Set<File> desiredAbsent=new HashSet<File>();
  final Set<File> desiredPresent=new HashSet<File>();
  final File targetDir=File.createTempFile("String_Node_Str","String_Node_Str");
  targetDir.delete();
  targetDir.mkdir();
  final File dir=new File(targetDir,DIR);
  dir.mkdir();
  final File fileA=new File(dir,FILE_A_NAME);
  writeFile(fileA,"String_Node_Str","String_Node_Str");
  final File origDir=File.createTempFile("String_Node_Str","String_Node_Str");
  origDir.delete();
  origDir.mkdir();
  final File origSubDir=new File(origDir,DIR);
  origSubDir.mkdirs();
  final File fileB=new File(origSubDir,FILE_B_NAME);
  writeFile(fileB,"String_Node_Str","String_Node_Str","String_Node_Str");
  try {
    desiredPresent.add(new File(targetDir.toURI().resolve(FILE_B_PREFIX + FILE_B_NAME)));
    desiredAbsent.add(new File(targetDir.toURI().resolve(FILE_A_PREFIX + FILE_A_NAME)));
    new CommonPermTest(){
      @Override protected CommonPermTest init(      File targetDir){
        super.init(targetDir);
        return this;
      }
      @Override protected void addParts(      Outbound ob,      PayloadFilesManager instance) throws Exception {
        ob.requestFileReplacement("String_Node_Str",URI.create(DIR),"String_Node_Str",null,origSubDir,true);
      }
      @Override protected void checkResults(      Inbound ib,      PayloadFilesManager instance) throws Exception {
        listDir("String_Node_Str",myTargetDir);
        instance.processParts(ib);
        listDir("String_Node_Str",myTargetDir);
        final Set<File> unexpectedlyPresent=new HashSet<File>();
        for (        File f : desiredAbsent) {
          if (f.exists()) {
            unexpectedlyPresent.add(f);
          }
        }
        assertEquals("String_Node_Str",Collections.EMPTY_SET,unexpectedlyPresent);
        final Set<File> unexpectedlyAbsent=new HashSet<File>();
        for (        File f : desiredPresent) {
          if (!f.exists()) {
            unexpectedlyAbsent.add(f);
          }
        }
        assertEquals("String_Node_Str",Collections.EMPTY_SET,unexpectedlyAbsent);
      }
      @Override protected void cleanup(){
        for (        File f : desiredAbsent) {
          if (f.exists()) {
            f.delete();
          }
        }
      }
    }
.init(targetDir).run("String_Node_Str");
  }
  finally {
    if (targetDir != null) {
      FileUtils.whack(targetDir);
    }
  }
}

Fixed version (ground truth):
@Test public void recursiveReplacementTest() throws Exception {
  final String DIR="String_Node_Str";
  final String FILE_A_PREFIX=DIR;
  final String FILE_A_NAME="String_Node_Str";
  final String FILE_B_PREFIX=DIR;
  final String FILE_B_NAME="String_Node_Str";
  final Set<File> desiredAbsent=new HashSet<File>();
  final Set<File> desiredPresent=new HashSet<File>();
  final File targetDir=File.createTempFile("String_Node_Str","String_Node_Str");
  targetDir.delete();
  targetDir.mkdir();
  final File dir=new File(targetDir,DIR);
  dir.mkdir();
  final File fileA=new File(dir,FILE_A_NAME);
  writeFile(fileA,"String_Node_Str","String_Node_Str");
  final File origDir=File.createTempFile("String_Node_Str","String_Node_Str");
  origDir.delete();
  origDir.mkdir();
  final File origSubDir=new File(origDir,DIR);
  origSubDir.mkdirs();
  final File fileB=new File(origSubDir,FILE_B_NAME);
  writeFile(fileB,"String_Node_Str","String_Node_Str","String_Node_Str");
  try {
    desiredPresent.add(new File(targetDir.toURI().resolve(FILE_B_PREFIX + FILE_B_NAME)));
    desiredAbsent.add(new File(targetDir.toURI().resolve(FILE_A_PREFIX + FILE_A_NAME)));
    new CommonPermTest(){
      @Override protected CommonPermTest init(      File targetDir){
        super.init(targetDir);
        return this;
      }
      @Override protected void addParts(      Outbound ob,      PayloadFilesManager instance) throws Exception {
        ob.requestFileReplacement("String_Node_Str",URI.create(DIR),"String_Node_Str",null,origSubDir,true);
      }
      @Override protected void checkResults(      Inbound ib,      PayloadFilesManager instance) throws Exception {
        listDir("String_Node_Str",myTargetDir);
        instance.processParts(ib);
        listDir("String_Node_Str",myTargetDir);
        final Set<File> unexpectedlyPresent=new HashSet<File>();
        for (        File f : desiredAbsent) {
          if (f.exists()) {
            unexpectedlyPresent.add(f);
          }
        }
        assertEquals("String_Node_Str",Collections.EMPTY_SET,unexpectedlyPresent);
        final Set<File> unexpectedlyAbsent=new HashSet<File>();
        for (        File f : desiredPresent) {
          if (!f.exists()) {
            unexpectedlyAbsent.add(f);
          }
        }
        assertEquals("String_Node_Str",Collections.EMPTY_SET,unexpectedlyAbsent);
      }
      @Override protected void cleanup(){
        for (        File f : desiredAbsent) {
          if (f.exists()) {
            f.delete();
          }
        }
        PayloadFilesManagerTest.cleanup(origDir);
      }
    }
.init(targetDir).run("String_Node_Str");
  }
  finally {
    if (targetDir != null) {
      FileUtils.whack(targetDir);
    }
  }
}