Program: 44641
Project: 44641
Buggy source:
private ContentObject saveAndAssertBinaryContentIsSaved(ContentObject contentObject,String contentSource,File fileWhichContainsContent,String property,Map<String,byte[]> binaryContent) throws Exception {
  try {
    contentObject=importService.importContentObject(contentSource,false,true,true,binaryContent);
    ContentObject object=contentService.getContentObject(contentObject.getId(),ResourceRepresentationType.CONTENT_OBJECT_INSTANCE,FetchLevel.ENTITY,CacheRegion.NONE,null,false);
    BinaryProperty imageProperty=(BinaryProperty)object.getCmsProperty(property);
    Assert.assertTrue(imageProperty.hasValues(),"String_Node_Str" + property + "String_Node_Str");
    for (    BinaryChannel imageBinaryChannel : imageProperty.getSimpleTypeValues()) {
      String sourceFilename=imageBinaryChannel.getSourceFilename();
      Assert.assertTrue(StringUtils.isNotBlank(sourceFilename),"String_Node_Str" + imageBinaryChannel.getName() + "String_Node_Str");
      File fileWhoseContentsAreSavedInBinaryChannel=null;
      if (sourceFilename.equals(fileWhichContainsContent.getName())) {
        fileWhoseContentsAreSavedInBinaryChannel=fileWhichContainsContent;
      }
 else {
        throw new Exception("String_Node_Str" + sourceFilename);
      }
      String mimeType=new MimetypesFileTypeMap().getContentType(fileWhoseContentsAreSavedInBinaryChannel);
      Assert.assertEquals(imageBinaryChannel.getName(),property);
      Assert.assertEquals(imageBinaryChannel.getMimeType(),mimeType);
      Assert.assertEquals(imageBinaryChannel.getSourceFilename(),sourceFilename);
      Assert.assertEquals(imageBinaryChannel.getSize(),FileUtils.readFileToByteArray(fileWhoseContentsAreSavedInBinaryChannel).length);
      Assert.assertEquals(imageBinaryChannel.getModified().getTimeInMillis(),fileWhoseContentsAreSavedInBinaryChannel.lastModified());
      Node binaryChannelNode=getSession().getNodeByUUID(imageBinaryChannel.getId());
      Assert.assertEquals(binaryChannelNode.getName(),imageBinaryChannel.getName(),"String_Node_Str" + binaryChannelNode.getPath());
      Assert.assertEquals(binaryChannelNode.getProperty(CmsBuiltInItem.Name.getJcrName()).getString(),property);
      Assert.assertEquals(binaryChannelNode.getProperty(JcrBuiltInItem.JcrMimeType.getJcrName()).getString(),mimeType);
      Assert.assertEquals(binaryChannelNode.getProperty(CmsBuiltInItem.SourceFileName.getJcrName()).getString(),sourceFilename);
      Assert.assertEquals(binaryChannelNode.getProperty(CmsBuiltInItem.Size.getJcrName()).getLong(),fileWhoseContentsAreSavedInBinaryChannel.length());
      Assert.assertEquals(binaryChannelNode.getProperty(JcrBuiltInItem.JcrLastModified.getJcrName()).getDate().getTimeInMillis(),fileWhoseContentsAreSavedInBinaryChannel.lastModified());
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",contentSource);
    throw e;
  }
  return contentObject;
}

Fixed version (ground truth):
private ContentObject saveAndAssertBinaryContentIsSaved(ContentObject contentObject,String contentSource,File fileWhichContainsContent,String property,Map<String,byte[]> binaryContent) throws Exception {
  try {
    contentObject=importService.importContentObject(contentSource,false,true,true,binaryContent);
    ContentObject object=contentService.getContentObject(contentObject.getId(),ResourceRepresentationType.CONTENT_OBJECT_INSTANCE,FetchLevel.ENTITY,CacheRegion.NONE,null,false);
    BinaryProperty imageProperty=(BinaryProperty)object.getCmsProperty(property);
    Assert.assertTrue(imageProperty.hasValues(),"String_Node_Str" + property + "String_Node_Str");
    for (    BinaryChannel imageBinaryChannel : imageProperty.getSimpleTypeValues()) {
      String sourceFilename=imageBinaryChannel.getSourceFilename();
      Assert.assertTrue(StringUtils.isNotBlank(sourceFilename),"String_Node_Str" + imageBinaryChannel.getName() + "String_Node_Str");
      File fileWhoseContentsAreSavedInBinaryChannel=null;
      if (sourceFilename.equals(fileWhichContainsContent.getName())) {
        fileWhoseContentsAreSavedInBinaryChannel=fileWhichContainsContent;
      }
 else {
        throw new Exception("String_Node_Str" + sourceFilename);
      }
      String mimeType=new MimetypesFileTypeMap().getContentType(fileWhoseContentsAreSavedInBinaryChannel);
      if (property.contains("String_Node_Str")) {
        Assert.assertEquals(imageBinaryChannel.getName(),StringUtils.substringAfterLast(property,"String_Node_Str"));
      }
 else {
        Assert.assertEquals(imageBinaryChannel.getName(),property);
      }
      Assert.assertEquals(imageBinaryChannel.getMimeType(),mimeType);
      Assert.assertEquals(imageBinaryChannel.getSourceFilename(),sourceFilename);
      Assert.assertEquals(imageBinaryChannel.getSize(),FileUtils.readFileToByteArray(fileWhoseContentsAreSavedInBinaryChannel).length);
      Assert.assertEquals(imageBinaryChannel.getModified().getTimeInMillis(),fileWhoseContentsAreSavedInBinaryChannel.lastModified());
      Node binaryChannelNode=getSession().getNodeByUUID(imageBinaryChannel.getId());
      Assert.assertEquals(binaryChannelNode.getName(),imageBinaryChannel.getName(),"String_Node_Str" + binaryChannelNode.getPath());
      if (property.contains("String_Node_Str")) {
        Assert.assertEquals(binaryChannelNode.getProperty(CmsBuiltInItem.Name.getJcrName()).getString(),StringUtils.substringAfterLast(property,"String_Node_Str"));
      }
 else {
        Assert.assertEquals(binaryChannelNode.getProperty(CmsBuiltInItem.Name.getJcrName()).getString(),property);
      }
      Assert.assertEquals(binaryChannelNode.getProperty(JcrBuiltInItem.JcrMimeType.getJcrName()).getString(),mimeType);
      Assert.assertEquals(binaryChannelNode.getProperty(CmsBuiltInItem.SourceFileName.getJcrName()).getString(),sourceFilename);
      Assert.assertEquals(binaryChannelNode.getProperty(CmsBuiltInItem.Size.getJcrName()).getLong(),fileWhoseContentsAreSavedInBinaryChannel.length());
      Assert.assertEquals(binaryChannelNode.getProperty(JcrBuiltInItem.JcrLastModified.getJcrName()).getDate().getTimeInMillis(),fileWhoseContentsAreSavedInBinaryChannel.lastModified());
    }
  }
 catch (  Exception e) {
    logger.error("String_Node_Str",contentSource);
    throw e;
  }
  return contentObject;
}