nus-yam/ex-repair huggingface dataset:
Program: 4105
Project: 4105
Buggy source:
private void visitOverwrittenTemplateFile(final PsiFile psiFile,final List<GotoRelatedItem> gotoRelatedItems,@NotNull String sectionName,int depth,@NotNull LazyVirtualFileTemplateResolver resolver){
  if (depth-- <= 0) {
    return;
  }
  BladeTemplateUtil.DirectiveParameterVisitor visitor=parameter -> {
    if (sectionName.equalsIgnoreCase(parameter.getContent())) {
      gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(parameter.getPsiElement()).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL));
    }
  }
;
  BladeTemplateUtil.visitSection(psiFile,visitor);
  BladeTemplateUtil.visitYield(psiFile,visitor);
  final int finalDepth=depth;
  BladeTemplateUtil.visitExtends(psiFile,parameter -> {
    for (    VirtualFile virtualFile : resolver.resolveTemplateName(psiFile.getProject(),parameter.getContent())) {
      PsiFile templatePsiFile=PsiManager.getInstance(psiFile.getProject()).findFile(virtualFile);
      if (templatePsiFile != null) {
        visitOverwrittenTemplateFile(templatePsiFile,gotoRelatedItems,sectionName,finalDepth,resolver);
      }
    }
  }
);
}

Fixed version (ground truth):
private void visitOverwrittenTemplateFile(@NotNull PsiFile psiFile,@NotNull List<GotoRelatedItem> gotoRelatedItems,@NotNull String sectionName,int depth,@NotNull LazyVirtualFileTemplateResolver resolver){
  if (depth-- <= 0) {
    return;
  }
  BladeTemplateUtil.DirectiveParameterVisitor visitor=parameter -> {
    if (sectionName.equalsIgnoreCase(parameter.getContent())) {
      gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(parameter.getPsiElement()).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL));
    }
  }
;
  BladeTemplateUtil.visitSection(psiFile,visitor);
  BladeTemplateUtil.visitYield(psiFile,visitor);
  final int finalDepth=depth;
  BladeTemplateUtil.visitExtends(psiFile,parameter -> {
    for (    VirtualFile virtualFile : resolver.resolveTemplateName(psiFile.getProject(),parameter.getContent())) {
      PsiFile templatePsiFile=PsiManager.getInstance(psiFile.getProject()).findFile(virtualFile);
      if (templatePsiFile != null) {
        visitOverwrittenTemplateFile(templatePsiFile,gotoRelatedItems,sectionName,finalDepth,resolver);
      }
    }
  }
);
}
Program: 4106
Project: 4106
Buggy source:
/** 
 * Support: @push('foobar')
 */
private void collectPushOverwrites(@NotNull PsiElement psiElement,@NotNull Collection<LineMarkerInfo> collection,@NotNull String sectionName){
  final List<GotoRelatedItem> gotoRelatedItems=new ArrayList<>();
  BladeTemplateUtil.visitUpPath(psiElement.getContainingFile(),10,parameter -> {
    if (sectionName.equalsIgnoreCase(parameter.getContent())) {
      gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(parameter.getPsiElement()).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL));
    }
  }
,BladeTokenTypes.STACK_DIRECTIVE);
  if (gotoRelatedItems.size() == 0) {
    return;
  }
  collection.add(getRelatedPopover("String_Node_Str","String_Node_Str",psiElement,gotoRelatedItems,PhpIcons.OVERRIDES));
}

Fixed version (ground truth):
/** 
 * Support: @push('foobar')
 */
@NotNull private Collection<LineMarkerInfo> collectPushOverwrites(@NotNull LeafPsiElement psiElement,@NotNull String sectionName){
  final List<GotoRelatedItem> gotoRelatedItems=new ArrayList<>();
  BladeTemplateUtil.visitUpPath(psiElement.getContainingFile(),10,parameter -> {
    if (sectionName.equalsIgnoreCase(parameter.getContent())) {
      gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(parameter.getPsiElement()).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL));
    }
  }
,BladeTokenTypes.STACK_DIRECTIVE);
  if (gotoRelatedItems.size() == 0) {
    return Collections.emptyList();
  }
  return Collections.singletonList(getRelatedPopover("String_Node_Str","String_Node_Str",psiElement,gotoRelatedItems,PhpIcons.OVERRIDES));
}
Program: 4108
Project: 4108
Buggy source:
/** 
 * Support: @slot('foobar')
 */
private void collectSlotOverwrites(@NotNull PsiElement psiElement,@NotNull Collection<LineMarkerInfo> collection,@NotNull String sectionName,@NotNull LazyVirtualFileTemplateResolver resolver){
  if (!(psiElement instanceof BladePsiDirectiveParameter)) {
    return;
  }
  String component=BladePsiUtil.findComponentForSlotScope((BladePsiDirectiveParameter)psiElement);
  if (component == null) {
    return;
  }
  List<GotoRelatedItem> gotoRelatedItems=new ArrayList<>();
  for (  VirtualFile virtualFile : resolver.resolveTemplateName(psiElement.getProject(),component)) {
    PsiFile file=PsiManager.getInstance(psiElement.getProject()).findFile(virtualFile);
    if (file == null) {
      continue;
    }
    gotoRelatedItems.addAll(BladePsiUtil.collectPrintBlockVariableTargets(file,sectionName).stream().map((Function<PsiElement,GotoRelatedItem>)element -> new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(element).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL)).collect(Collectors.toList()));
  }
  if (gotoRelatedItems.size() == 0) {
    return;
  }
  collection.add(getRelatedPopover("String_Node_Str","String_Node_Str",psiElement,gotoRelatedItems,PhpIcons.OVERRIDES));
}

Fixed version (ground truth):
/** 
 * Support: @slot('foobar')
 */
@NotNull private Collection<LineMarkerInfo> collectSlotOverwrites(@NotNull LeafPsiElement psiElement,@NotNull BladePsiDirectiveParameter parameter,@NotNull String sectionName,@NotNull LazyVirtualFileTemplateResolver resolver){
  String component=BladePsiUtil.findComponentForSlotScope(parameter);
  if (component == null) {
    return Collections.emptyList();
  }
  List<GotoRelatedItem> gotoRelatedItems=new ArrayList<>();
  for (  VirtualFile virtualFile : resolver.resolveTemplateName(psiElement.getProject(),component)) {
    PsiFile file=PsiManager.getInstance(psiElement.getProject()).findFile(virtualFile);
    if (file == null) {
      continue;
    }
    gotoRelatedItems.addAll(BladePsiUtil.collectPrintBlockVariableTargets(file,sectionName).stream().map((Function<PsiElement,GotoRelatedItem>)element -> new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(element).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL)).collect(Collectors.toList()));
  }
  if (gotoRelatedItems.size() == 0) {
    return Collections.emptyList();
  }
  return Collections.singletonList(getRelatedPopover("String_Node_Str","String_Node_Str",psiElement,gotoRelatedItems,PhpIcons.OVERRIDES));
}
Program: 4109
Project: 4109
Buggy source:
/** 
 * Find all sub implementations of a section that are overwritten by an extends tag Possible targets are: @section('sidebar')
 */
private void collectImplementsSection(@NotNull PsiElement psiElement,@NotNull Collection<LineMarkerInfo> collection,@NotNull String sectionName,@NotNull LazyVirtualFileTemplateResolver resolver){
  Collection<String> templateNames=resolver.resolveTemplateName(psiElement.getContainingFile());
  if (templateNames.size() == 0) {
    return;
  }
  Collection<GotoRelatedItem> gotoRelatedItems=new ArrayList<>();
  Set<VirtualFile> virtualFiles=BladeTemplateUtil.getExtendsImplementations(psiElement.getProject(),templateNames);
  if (virtualFiles.size() == 0) {
    return;
  }
  for (  VirtualFile virtualFile : virtualFiles) {
    PsiFile psiFile=PsiManager.getInstance(psiElement.getProject()).findFile(virtualFile);
    if (psiFile != null) {
      BladeTemplateUtil.visitSection(psiFile,parameter -> {
        if (sectionName.equalsIgnoreCase(parameter.getContent())) {
          gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(parameter.getPsiElement()).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL));
        }
      }
);
    }
  }
  if (gotoRelatedItems.size() == 0) {
    return;
  }
  collection.add(getRelatedPopover("String_Node_Str","String_Node_Str",psiElement,gotoRelatedItems,PhpIcons.IMPLEMENTED));
}

Fixed version (ground truth):
/** 
 * Find all sub implementations of a section that are overwritten by an extends tag Possible targets are: @section('sidebar')
 */
@NotNull private Collection<LineMarkerInfo> collectImplementsSection(@NotNull LeafPsiElement psiElement,@NotNull String sectionName,@NotNull LazyVirtualFileTemplateResolver resolver){
  Collection<String> templateNames=resolver.resolveTemplateName(psiElement.getContainingFile());
  if (templateNames.size() == 0) {
    return Collections.emptyList();
  }
  Collection<GotoRelatedItem> gotoRelatedItems=new ArrayList<>();
  Set<VirtualFile> virtualFiles=BladeTemplateUtil.getExtendsImplementations(psiElement.getProject(),templateNames);
  if (virtualFiles.size() == 0) {
    return Collections.emptyList();
  }
  for (  VirtualFile virtualFile : virtualFiles) {
    PsiFile psiFile=PsiManager.getInstance(psiElement.getProject()).findFile(virtualFile);
    if (psiFile != null) {
      BladeTemplateUtil.visitSection(psiFile,parameter -> {
        if (sectionName.equalsIgnoreCase(parameter.getContent())) {
          gotoRelatedItems.add(new RelatedPopupGotoLineMarker.PopupGotoRelatedItem(parameter.getPsiElement()).withIcon(LaravelIcons.LARAVEL,LaravelIcons.LARAVEL));
        }
      }
);
    }
  }
  if (gotoRelatedItems.size() == 0) {
    return Collections.emptyList();
  }
  return Collections.singletonList(getRelatedPopover("String_Node_Str","String_Node_Str",psiElement,gotoRelatedItems,PhpIcons.IMPLEMENTED));
}
Program: 4110
Project: 4110
Buggy source:
/** 
 * Extract parameter: @foobar('my_value')
 */
@Nullable private Pair<PsiElement,String> extractSectionParameter(@NotNull PsiElement psiElement){
  PsiElement nextSibling=psiElement.getNextSibling();
  if (nextSibling instanceof BladePsiDirectiveParameter) {
    String sectionName=BladePsiUtil.getSection(nextSibling);
    if (sectionName != null && StringUtils.isNotBlank(sectionName)) {
      return Pair.create(nextSibling,sectionName);
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Extract parameter: @foobar('my_value')
 */
@Nullable private Pair<BladePsiDirectiveParameter,String> extractSectionParameter(@NotNull PsiElement psiElement){
  PsiElement nextSibling=psiElement.getNextSibling();
  if (nextSibling instanceof BladePsiDirectiveParameter) {
    String sectionName=BladePsiUtil.getSection(nextSibling);
    if (sectionName != null && StringUtils.isNotBlank(sectionName)) {
      return Pair.create((BladePsiDirectiveParameter)nextSibling,sectionName);
    }
  }
  return null;
}
Program: 4112
Project: 4112
Buggy source:
public static void visitController(@NotNull final Project project,@NotNull ControllerVisitor visitor,@Nullable String prefix){
  Collection<PhpClass> allSubclasses=new HashSet<PhpClass>(){
{
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
    }
  }
;
  String ns=prefix;
  boolean prioritised=false;
  if (prefix == null) {
    ns=getDefaultNamespace(project);
    prioritised=true;
  }
  for (  PhpClass phpClass : allSubclasses) {
    if (phpClass.isAbstract()) {
      continue;
    }
    String className=phpClass.getPresentableFQN();
    if (className == null) {
      continue;
    }
    if (className.startsWith(ns + "String_Node_Str")) {
      className=className.substring(ns.length() + 1);
    }
    if (StringUtils.isNotBlank(className)) {
      visitor.visit(phpClass,className,prioritised);
    }
  }
}

Fixed version (ground truth):
public static void visitController(@NotNull final Project project,@NotNull ControllerVisitor visitor,@Nullable String prefix){
  Collection<PhpClass> allSubclasses=new HashSet<PhpClass>(){
{
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
    }
  }
;
  String ns=getDefaultNamespace(project) + "String_Node_Str";
  String prefixedNs=ns + (prefix != null && !prefix.equals("String_Node_Str") ? prefix + "String_Node_Str" : "String_Node_Str");
  for (  PhpClass phpClass : allSubclasses) {
    if (phpClass.isAbstract()) {
      continue;
    }
    String className=phpClass.getPresentableFQN();
    boolean prioritised=false;
    if (prefix != null && className.startsWith(prefixedNs)) {
      className=className.substring(prefixedNs.length());
      prioritised=true;
    }
 else     if (className.startsWith(ns)) {
      className=className.substring(ns.length());
    }
    if (StringUtils.isNotBlank(className)) {
      visitor.visit(phpClass,className,prioritised);
    }
  }
}
Program: 4114
Project: 4114
Buggy source:
public void testRouteUsesInsideArray(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testRouteUsesInsideArray(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 4115
Project: 4115
Buggy source:
public void testRouteParameter(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str");
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
}

Fixed version (ground truth):
public void testRouteParameter(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
}
Program: 4116
Project: 4116
Buggy source:
public static void visitController(@NotNull final Project project,@NotNull ControllerVisitor visitor,@Nullable String prefix){
  Collection<PhpClass> allSubclasses=new HashSet<PhpClass>(){
{
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
    }
  }
;
  String ns=prefix;
  boolean prioritised=false;
  if (prefix == null) {
    ns=getDefaultNamespace(project);
    prioritised=true;
  }
  for (  PhpClass phpClass : allSubclasses) {
    if (phpClass.isAbstract()) {
      continue;
    }
    String className=phpClass.getPresentableFQN();
    if (className == null) {
      continue;
    }
    if (className.startsWith(ns + "String_Node_Str")) {
      className=className.substring(ns.length() + 1);
    }
    if (StringUtils.isNotBlank(className)) {
      visitor.visit(phpClass,className,prioritised);
    }
  }
}

Fixed version (ground truth):
public static void visitController(@NotNull final Project project,@NotNull ControllerVisitor visitor,@Nullable String prefix){
  Collection<PhpClass> allSubclasses=new HashSet<PhpClass>(){
{
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
      addAll(PhpIndex.getInstance(project).getAllSubclasses("String_Node_Str"));
    }
  }
;
  String ns=getDefaultNamespace(project) + "String_Node_Str";
  String prefixedNs=ns + (prefix != null && !prefix.equals("String_Node_Str") ? prefix + "String_Node_Str" : "String_Node_Str");
  for (  PhpClass phpClass : allSubclasses) {
    if (phpClass.isAbstract()) {
      continue;
    }
    String className=phpClass.getPresentableFQN();
    boolean prioritised=false;
    if (prefix != null && className.startsWith(prefixedNs)) {
      className=className.substring(prefixedNs.length());
      prioritised=true;
    }
 else     if (className.startsWith(ns)) {
      className=className.substring(ns.length());
    }
    if (StringUtils.isNotBlank(className)) {
      visitor.visit(phpClass,className,prioritised);
    }
  }
}
Program: 4118
Project: 4118
Buggy source:
public void testRouteUsesInsideArray(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str","String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
public void testRouteUsesInsideArray(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
}
Program: 4119
Project: 4119
Buggy source:
public void testRouteParameter(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str");
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
}

Fixed version (ground truth):
public void testRouteParameter(){
  assertCompletionContains(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str");
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
  assertNavigationMatch(PhpFileType.INSTANCE,"String_Node_Str" + "String_Node_Str",PlatformPatterns.psiElement(Method.class));
}
Program: 4120
Project: 4120
Buggy source:
@Override public boolean visitFile(@NotNull VirtualFile virtualFile){
  if (virtualFile.isDirectory() || !isTemplateFile(virtualFile)) {
    return true;
  }
  String filename=VfsUtil.getRelativePath(virtualFile,templateDir,'.');
  if (filename == null) {
    return true;
  }
  if (filename.endsWith("String_Node_Str")) {
    filename=filename.substring(0,filename.length() - 4);
  }
  if (filename.endsWith("String_Node_Str")) {
    filename=filename.substring(0,filename.length() - 6);
  }
  if (filename.endsWith("String_Node_Str")) {
    filename=filename.substring(0,filename.length() - "String_Node_Str".length());
  }
  if (templatePath.getNamespace() != null) {
    visitor.visit(virtualFile,templatePath.getNamespace() + "String_Node_Str" + filename);
  }
 else {
    visitor.visit(virtualFile,filename);
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean visitFile(@NotNull VirtualFile virtualFile){
  if (virtualFile.isDirectory() || !isTemplateFile(virtualFile)) {
    return true;
  }
  String filename=VfsUtil.getRelativePath(virtualFile,templateDir,'.');
  if (filename == null) {
    return true;
  }
  if (filename.endsWith("String_Node_Str")) {
    filename=filename.substring(0,filename.length() - 4);
  }
  if (filename.endsWith("String_Node_Str")) {
    filename=filename.substring(0,filename.length() - 6);
  }
  if (filename.endsWith("String_Node_Str")) {
    filename=filename.substring(0,filename.length() - "String_Node_Str".length());
  }
  String namespace=templatePath.getNamespace();
  if (namespace != null && StringUtils.isNotBlank(namespace)) {
    visitor.visit(virtualFile,namespace + "String_Node_Str" + filename);
  }
 else {
    visitor.visit(virtualFile,filename);
  }
  return true;
}
Program: 4122
Project: 4122
Buggy source:
/** 
 * Single resolve doesnt work if we have non unique class names in project context, so try a multiResolve and use first matched method
 */
@Nullable protected static Method getMultiResolvedMethod(PsiReference psiReference){
  PsiElement resolvedReference=psiReference.resolve();
  if (resolvedReference instanceof Method) {
    return (Method)resolvedReference;
  }
  if (psiReference instanceof PsiPolyVariantReference) {
    for (    ResolveResult resolveResult : ((PsiPolyVariantReference)psiReference).multiResolve(false)) {
      PsiElement element=resolveResult.getElement();
      if (element instanceof Method) {
        return (Method)element;
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Single resolve doesnt work if we have non unique class names in project context, so try a multiResolve and use first matched method
 */
@Nullable public static Method getMultiResolvedMethod(PsiReference psiReference){
  PsiElement resolvedReference=psiReference.resolve();
  if (resolvedReference instanceof Method) {
    return (Method)resolvedReference;
  }
  if (psiReference instanceof PsiPolyVariantReference) {
    for (    ResolveResult resolveResult : ((PsiPolyVariantReference)psiReference).multiResolve(false)) {
      PsiElement element=resolveResult.getElement();
      if (element instanceof Method) {
        return (Method)element;
      }
    }
  }
  return null;
}
Program: 4123
Project: 4123
Buggy source:
@Nullable public static MethodReferenceBag getMethodParameterReferenceBag(PsiElement psiElement,int wantIndex){
  PsiElement variableContext=psiElement.getContext();
  if (!(variableContext instanceof ParameterList)) {
    return null;
  }
  ParameterList parameterList=(ParameterList)variableContext;
  if (!(parameterList.getContext() instanceof MethodReference)) {
    return null;
  }
  MethodReference methodReference=(MethodReference)parameterList.getContext();
  PsiElement method=methodReference.resolve();
  if (!(method instanceof Method)) {
    return null;
  }
  ParameterBag currentIndex=getCurrentParameterIndex(psiElement);
  if (currentIndex == null) {
    return null;
  }
  if (wantIndex >= 0 && currentIndex.getIndex() != wantIndex) {
    return null;
  }
  return new MethodReferenceBag(parameterList,methodReference,currentIndex);
}

Fixed version (ground truth):
@Nullable public static MethodReferenceBag getMethodParameterReferenceBag(PsiElement psiElement,int wantIndex){
  PsiElement variableContext=psiElement.getContext();
  if (!(variableContext instanceof ParameterList)) {
    return null;
  }
  ParameterList parameterList=(ParameterList)variableContext;
  if (!(parameterList.getContext() instanceof MethodReference)) {
    return null;
  }
  ParameterBag currentIndex=getCurrentParameterIndex(psiElement);
  if (currentIndex == null) {
    return null;
  }
  if (wantIndex >= 0 && currentIndex.getIndex() != wantIndex) {
    return null;
  }
  return new MethodReferenceBag(parameterList,(MethodReference)parameterList.getContext(),currentIndex);
}
Program: 4124
Project: 4124
Buggy source:
@Override public void onCreate(){
  LocationListener listener=new LocationListener(){
    @Override public void onLocationChanged(    Location location){
      if (lastLocation == null) {
        lastLocation=location;
      }
      distanceInMeters+=location.distanceTo(lastLocation);
      lastLocation=location;
    }
    @Override public void onProviderDisabled(    String arg0){
    }
    @Override public void onProviderEnabled(    String arg0){
    }
    @Override public void onStatusChanged(    String arg0,    int arg1,    Bundle bundle){
    }
  }
;
  LocationManager locManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
  locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1000,1,listener);
}

Fixed version (ground truth):
@Override public void onCreate(){
  listener=new LocationListener(){
    @Override public void onLocationChanged(    Location location){
      if (lastLocation == null) {
        lastLocation=location;
      }
      distanceInMeters+=location.distanceTo(lastLocation);
      lastLocation=location;
    }
    @Override public void onProviderDisabled(    String arg0){
    }
    @Override public void onProviderEnabled(    String arg0){
    }
    @Override public void onStatusChanged(    String arg0,    int arg1,    Bundle bundle){
    }
  }
;
  locManager=(LocationManager)getSystemService(Context.LOCATION_SERVICE);
  locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,1000,1,listener);
}
Program: 4125
Project: 4125
Buggy source:
private void startDrag(){
  draggedItem.onDragStart();
  requestDisallowInterceptTouchEvent(true);
}

Fixed version (ground truth):
private void startDrag(){
  layoutTransition=getLayoutTransition();
  if (layoutTransition != null) {
    setLayoutTransition(null);
  }
  draggedItem.onDragStart();
  requestDisallowInterceptTouchEvent(true);
}
Program: 4126
Project: 4126
Buggy source:
/** 
 * Animates the dragged item to its final resting position.
 */
private void onDragStop(){
  draggedItem.settleAnimation=ValueAnimator.ofFloat(draggedItem.totalDragOffset,draggedItem.totalDragOffset - draggedItem.targetTopOffset).setDuration(getTranslateAnimationDuration(draggedItem.targetTopOffset));
  draggedItem.settleAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      if (!draggedItem.detecting)       return;
      draggedItem.setTotalOffset(((Float)animation.getAnimatedValue()).intValue());
      final int shadowAlpha=(int)((1 - animation.getAnimatedFraction()) * 255);
      if (null != dragTopShadowDrawable)       dragTopShadowDrawable.setAlpha(shadowAlpha);
      dragBottomShadowDrawable.setAlpha(shadowAlpha);
      invalidate();
    }
  }
);
  draggedItem.settleAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationStart(    Animator animation){
      draggedItem.onDragStop();
    }
    @Override public void onAnimationEnd(    Animator animation){
      if (!draggedItem.detecting) {
        return;
      }
      draggedItem.settleAnimation=null;
      draggedItem.stopDetecting();
      if (null != dragTopShadowDrawable)       dragTopShadowDrawable.setAlpha(255);
      dragBottomShadowDrawable.setAlpha(255);
    }
  }
);
  draggedItem.settleAnimation.start();
}

Fixed version (ground truth):
/** 
 * Animates the dragged item to its final resting position.
 */
private void onDragStop(){
  draggedItem.settleAnimation=ValueAnimator.ofFloat(draggedItem.totalDragOffset,draggedItem.totalDragOffset - draggedItem.targetTopOffset).setDuration(getTranslateAnimationDuration(draggedItem.targetTopOffset));
  draggedItem.settleAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(){
    @Override public void onAnimationUpdate(    ValueAnimator animation){
      if (!draggedItem.detecting)       return;
      draggedItem.setTotalOffset(((Float)animation.getAnimatedValue()).intValue());
      final int shadowAlpha=(int)((1 - animation.getAnimatedFraction()) * 255);
      if (null != dragTopShadowDrawable)       dragTopShadowDrawable.setAlpha(shadowAlpha);
      dragBottomShadowDrawable.setAlpha(shadowAlpha);
      invalidate();
    }
  }
);
  draggedItem.settleAnimation.addListener(new AnimatorListenerAdapter(){
    @Override public void onAnimationStart(    Animator animation){
      draggedItem.onDragStop();
    }
    @Override public void onAnimationEnd(    Animator animation){
      if (!draggedItem.detecting) {
        return;
      }
      draggedItem.settleAnimation=null;
      draggedItem.stopDetecting();
      if (null != dragTopShadowDrawable)       dragTopShadowDrawable.setAlpha(255);
      dragBottomShadowDrawable.setAlpha(255);
      if (layoutTransition != null && getLayoutTransition() == null) {
        setLayoutTransition(layoutTransition);
      }
    }
  }
);
  draggedItem.settleAnimation.start();
}
Program: 4127
Project: 4127
Buggy source:
/** 
 * Sets background color for this button. <p/> Xml attribute:   {@code app:floatingActionButtonColor}
 * @param color color
 */
public void setColor(int color){
  mColor=color;
}

Fixed version (ground truth):
/** 
 * Sets background color for this button. <p/> Xml attribute:   {@code app:floatingActionButtonColor}<p/> NOTE: this method sets the <code>mColorStateList</code> field to <code>null</code>
 * @param color color
 */
public void setColor(int color){
  mColor=color;
  mColorStateList=null;
}
Program: 4128
Project: 4128
Buggy source:
@Override protected void drawableStateChanged(){
  super.drawableStateChanged();
  if (mCircleDrawable != null && mColorStateList != null) {
    mCircleDrawable.setColor(mColorStateList.getColorForState(getDrawableState(),mColor));
  }
}

Fixed version (ground truth):
@Override protected void drawableStateChanged(){
  super.drawableStateChanged();
  if (mCircleDrawable != null && mColorStateList != null) {
    mCircleDrawable.setColor(mColorStateList.getColorForState(getDrawableState(),mColor));
    invalidate();
  }
}
Program: 4129
Project: 4129
Buggy source:
private void runHorizonLeftAnimation(View view,long delay){
  view.setAlpha(0);
  ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(view,"String_Node_Str",-ViewUtils.getScreenWidth(),0);
  objectAnimator.setInterpolator(new LinearInterpolator());
  objectAnimator.start();
  ObjectAnimator objectAnimatorAlpha=ObjectAnimator.ofFloat(view,"String_Node_Str",0f,1f);
  AnimatorSet set=new AnimatorSet();
  set.setDuration(mDuration);
  set.setStartDelay(delay);
  set.playTogether(objectAnimator,objectAnimatorAlpha);
  set.start();
}

Fixed version (ground truth):
private void runHorizonLeftAnimation(View view,long delay){
  view.setAlpha(0);
  ObjectAnimator objectAnimator=ObjectAnimator.ofFloat(view,"String_Node_Str",-ViewUtils.getScreenWidth(),0);
  objectAnimator.setInterpolator(new LinearInterpolator());
  ObjectAnimator objectAnimatorAlpha=ObjectAnimator.ofFloat(view,"String_Node_Str",0f,1f);
  AnimatorSet set=new AnimatorSet();
  set.setDuration(mDuration);
  set.setStartDelay(delay);
  set.playTogether(objectAnimator,objectAnimatorAlpha);
  set.start();
}
Program: 4130
Project: 4130
Buggy source:
/** 
 * A CronDefinition with only 3 required fields is legal to instantiate, but the parser considers an expression with 4 fields as an error: java.lang.IllegalArgumentException: Cron expression contains 4 parts but we expect one of [6, 7]
 */
public void testThreeRequiredFieldsSupported() throws Exception {
  CronDefinition cronDefinition=CronDefinitionBuilder.defineCron().withSeconds().and().withMinutes().and().withHours().and().withDayOfMonth().supportsL().supportsW().supportsLW().supportsQuestionMark().optional().and().withMonth().optional().and().withDayOfWeek().withValidRange(1,7).withMondayDoWValue(2).supportsHash().supportsL().supportsQuestionMark().optional().and().withYear().withValidRange(2000,2099).optional().and().instance();
  CronParser cronParser=new CronParser(cronDefinition);
  cronParser.parse("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * A CronDefinition with only 3 required fields is legal to instantiate, but the parser considers an expression with 4 fields as an error: java.lang.IllegalArgumentException: Cron expression contains 4 parts but we expect one of [6, 7]
 */
public void testThreeRequiredFieldsSupported(){
  final CronDefinition cronDefinition=CronDefinitionBuilder.defineCron().withSeconds().and().withMinutes().and().withHours().and().withDayOfMonth().supportsL().supportsW().supportsLW().supportsQuestionMark().optional().and().withMonth().optional().and().withDayOfWeek().withValidRange(1,7).withMondayDoWValue(2).supportsHash().supportsL().supportsQuestionMark().optional().and().withYear().withValidRange(2000,2099).optional().and().instance();
  final CronParser cronParser=new CronParser(cronDefinition);
  cronParser.parse("String_Node_Str");
}
Program: 4131
Project: 4131
Buggy source:
/** 
 * Issue #52: "And" doesn't work for day of the week 1,2 should be Monday and Tuesday, but instead it is treated as 1st/2nd of month.
 */
@Test public void testWeekdayAndLastExecution(){
  final String crontab="String_Node_Str";
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  final CronParser parser=new CronParser(cronDefinition);
  final Cron cron=parser.parse(crontab);
  final ZonedDateTime date=ZonedDateTime.parse("String_Node_Str");
  final ExecutionTime executionTime=ExecutionTime.forCron(cron);
  final Optional<ZonedDateTime> lastExecution=executionTime.lastExecution(date);
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Issue #52: "And" doesn't work for day of the week 1,2 should be Monday and Tuesday, but instead it is treated as 1st/2nd of month.
 */
@Test public void testWeekdayAndLastExecution(){
  final Cron cron=getUnixCron("String_Node_Str");
  final Optional<ZonedDateTime> lastExecution=getLastExecutionFor(cron,ZonedDateTime.parse("String_Node_Str"));
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4132
Project: 4132
Buggy source:
/** 
 * Issue #50: last execution does not match expected date when cron specifies day of week and last execution is in previous month.
 */
@Test public void testLastExecutionDaysOfWeekOverMonthBoundary(){
  final String crontab="String_Node_Str";
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  final CronParser parser=new CronParser(cronDefinition);
  final Cron cron=parser.parse(crontab);
  final ZonedDateTime date=ZonedDateTime.parse("String_Node_Str");
  final ExecutionTime executionTime=ExecutionTime.forCron(cron);
  final Optional<ZonedDateTime> lastExecution=executionTime.lastExecution(date);
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Issue #50: last execution does not match expected date when cron specifies day of week and last execution is in previous month.
 */
@Test public void testLastExecutionDaysOfWeekOverMonthBoundary(){
  final Cron cron=getUnixCron("String_Node_Str");
  final Optional<ZonedDateTime> lastExecution=getLastExecutionFor(cron,ZonedDateTime.parse("String_Node_Str"));
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4133
Project: 4133
Buggy source:
/** 
 * Isue #52: Additional test to ensure after fix that "And" and "Between" can both be used 1,2-3 should be Monday, Tuesday and Wednesday.
 */
@Test public void testWeekdayAndWithMixOfOnAndBetweenLastExecution(){
  final String crontab="String_Node_Str";
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  final CronParser parser=new CronParser(cronDefinition);
  final Cron cron=parser.parse(crontab);
  final ZonedDateTime date=ZonedDateTime.parse("String_Node_Str");
  final ExecutionTime executionTime=ExecutionTime.forCron(cron);
  final Optional<ZonedDateTime> lastExecution=executionTime.lastExecution(date);
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Isue #52: Additional test to ensure after fix that "And" and "Between" can both be used 1,2-3 should be Monday, Tuesday and Wednesday.
 */
@Test public void testWeekdayAndWithMixOfOnAndBetweenLastExecution(){
  final Cron cron=getUnixCron("String_Node_Str");
  final Optional<ZonedDateTime> lastExecution=getLastExecutionFor(cron,ZonedDateTime.parse("String_Node_Str"));
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4134
Project: 4134
Buggy source:
/** 
 * Issue #69: Getting next execution fails on leap-year when using day-of-week.
 */
@Test public void testCorrectNextExecutionDoWForLeapYear(){
  final CronParser parser=new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX));
  final String crontab="String_Node_Str";
  final ExecutionTime executionTime=ExecutionTime.forCron(parser.parse(crontab));
  final ZonedDateTime scanTime=ZonedDateTime.parse("String_Node_Str");
  final Optional<ZonedDateTime> nextExecution=executionTime.nextExecution(scanTime);
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Issue #69: Getting next execution fails on leap-year when using day-of-week.
 */
@Test public void testCorrectNextExecutionDoWForLeapYear(){
  final Optional<ZonedDateTime> nextExecution=getNextExecutionFor(getUnixCron("String_Node_Str"),ZonedDateTime.parse("String_Node_Str"));
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4135
Project: 4135
Buggy source:
/** 
 * Issue #59: Incorrect next execution time for "month" and "day of week". Considers bad DoW
 */
@Test public void testCorrectNextExecutionDoW(){
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  final CronParser parser=new CronParser(cronDefinition);
  final String crontab="String_Node_Str";
  final Cron cron=parser.parse(crontab);
  final ExecutionTime executionTime=ExecutionTime.forCron(cron);
  final ZonedDateTime scanTime=ZonedDateTime.parse("String_Node_Str");
  final Optional<ZonedDateTime> nextExecution=executionTime.nextExecution(scanTime);
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Issue #59: Incorrect next execution time for "month" and "day of week". Considers bad DoW
 */
@Test public void testCorrectNextExecutionDoW(){
  final Cron cron=getUnixCron("String_Node_Str");
  final Optional<ZonedDateTime> nextExecution=getNextExecutionFor(cron,ZonedDateTime.parse("String_Node_Str"));
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4136
Project: 4136
Buggy source:
/** 
 * Issue #45: last execution does not match expected date. Result is not in same timezone as reference date.
 */
@Test public void testMondayWeekdayLastExecution(){
  final String crontab="String_Node_Str";
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  final CronParser parser=new CronParser(cronDefinition);
  final Cron cron=parser.parse(crontab);
  final ZonedDateTime date=ZonedDateTime.parse("String_Node_Str");
  final ExecutionTime executionTime=ExecutionTime.forCron(cron);
  final Optional<ZonedDateTime> lastExecution=executionTime.lastExecution(date);
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Issue #45: last execution does not match expected date. Result is not in same timezone as reference date.
 */
@Test public void testMondayWeekdayLastExecution(){
  final Cron cron=getUnixCron("String_Node_Str");
  final Optional<ZonedDateTime> lastExecution=getLastExecutionFor(cron,ZonedDateTime.parse("String_Node_Str"));
  if (lastExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4137
Project: 4137
Buggy source:
/** 
 * Issue #59: Incorrect next execution time for "month" and "day of week". Considers Month in range 0-11 instead of 1-12
 */
@Test public void testCorrectMonthScaleForNextExecution1(){
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  final CronParser parser=new CronParser(cronDefinition);
  final String crontab="String_Node_Str";
  final Cron cron=parser.parse(crontab);
  final ExecutionTime executionTime=ExecutionTime.forCron(cron);
  final ZonedDateTime scanTime=ZonedDateTime.parse("String_Node_Str");
  final Optional<ZonedDateTime> nextExecution=executionTime.nextExecution(scanTime);
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Issue #59: Incorrect next execution time for "month" and "day of week". Considers Month in range 0-11 instead of 1-12
 */
@Test public void testCorrectMonthScaleForNextExecution1(){
  final Cron cron=getUnixCron("String_Node_Str");
  final Optional<ZonedDateTime> nextExecution=getNextExecutionFor(cron,ZonedDateTime.parse("String_Node_Str"));
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4138
Project: 4138
Buggy source:
/** 
 * Issue #59: Incorrect next execution time for "day of month" in "time" situation dom "* / 4" should mean 1, 5, 9, 13, 17th... of month instead of 4, 8, 12, 16th...
 */
@Test public void testCorrectMonthScaleForNextExecution2(){
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.UNIX);
  final CronParser parser=new CronParser(cronDefinition);
  final String crontab="String_Node_Str";
  final Cron cron=parser.parse(crontab);
  final ExecutionTime executionTime=ExecutionTime.forCron(cron);
  final ZonedDateTime scanTime=ZonedDateTime.parse("String_Node_Str");
  final Optional<ZonedDateTime> nextExecution=executionTime.nextExecution(scanTime);
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}

Fixed version (ground truth):
/** 
 * Issue #59: Incorrect next execution time for "day of month" in "time" situation dom "* / 4" should mean 1, 5, 9, 13, 17th... of month instead of 4, 8, 12, 16th...
 */
@Test public void testCorrectMonthScaleForNextExecution2(){
  final Cron cron=getUnixCron("String_Node_Str");
  final Optional<ZonedDateTime> nextExecution=getNextExecutionFor(cron,ZonedDateTime.parse("String_Node_Str"));
  if (nextExecution.isPresent()) {
    assertEquals(ZonedDateTime.parse("String_Node_Str"),nextExecution.get());
  }
 else {
    fail(NEXT_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4139
Project: 4139
Buggy source:
@Test public void testFull(){
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ);
  final CronParser parser=new CronParser(cronDefinition);
  final Cron cron=parser.parse("String_Node_Str");
  System.out.println(CronDescriptor.instance().describe(cron));
}

Fixed version (ground truth):
@Test public void testFull(){
  final Cron cron=getCron("String_Node_Str");
  assertEquals("String_Node_Str" + "String_Node_Str",descriptor.describe(cron));
}
Program: 4140
Project: 4140
Buggy source:
public void testCase3(){
  ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime actual=et.lastExecution(currentDateTime).get();
  ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2015,12,31,12,00),ZoneId.systemDefault());
  Assert.assertEquals(expected,actual);
}

Fixed version (ground truth):
@Test @Ignore public void testCase3(){
  final ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  final Optional<ZonedDateTime> lastExecution=et.lastExecution(currentDateTime);
  if (lastExecution.isPresent()) {
    final ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2015,12,31,12,00),ZoneId.systemDefault());
    Assert.assertEquals(expected,lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4141
Project: 4141
Buggy source:
@Test public void testCase2(){
  ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime actual=et.lastExecution(currentDateTime).get();
  ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2012,12,29,12,00),ZoneId.systemDefault());
  Assert.assertEquals(expected,actual);
}

Fixed version (ground truth):
@Test public void testCase2(){
  final ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  final Optional<ZonedDateTime> lastExecution=et.lastExecution(currentDateTime);
  if (lastExecution.isPresent()) {
    final ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2012,12,29,12,00),ZoneId.systemDefault());
    Assert.assertEquals(expected,lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4142
Project: 4142
Buggy source:
@Test public void testCase4(){
  ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime actual=et.lastExecution(currentDateTime).get();
  ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2016,10,29,12,00),ZoneId.systemDefault());
  Assert.assertEquals(expected,actual);
}

Fixed version (ground truth):
@Test public void testCase4(){
  final ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  final Optional<ZonedDateTime> lastExecution=et.lastExecution(currentDateTime);
  if (lastExecution.isPresent()) {
    final ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2016,10,29,12,00),ZoneId.systemDefault());
    Assert.assertEquals(expected,lastExecution.get());
  }
 else {
    fail(LAST_EXECUTION_NOT_PRESENT_ERROR);
  }
}
Program: 4143
Project: 4143
Buggy source:
@Before public void setUp() throws Exception {
  currentDateTime=ZonedDateTime.of(LocalDateTime.of(2016,12,20,12,00),ZoneId.systemDefault());
  parser=new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
}

Fixed version (ground truth):
@Before public void setUp(){
  currentDateTime=ZonedDateTime.of(LocalDateTime.of(2016,12,20,12,00),ZoneId.systemDefault());
  parser=new CronParser(CronDefinitionBuilder.instanceDefinitionFor(CronType.QUARTZ));
}
Program: 4144
Project: 4144
Buggy source:
@Test public void testCase1(){
  ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  ZonedDateTime actual=et.lastExecution(currentDateTime).get();
  ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2015,12,31,12,00),ZoneId.systemDefault());
  Assert.assertEquals(expected,actual);
}

Fixed version (ground truth):
@Test public void testCase1(){
  final ExecutionTime et=ExecutionTime.forCron(parser.parse("String_Node_Str"));
  final Optional<ZonedDateTime> lastExecution=et.lastExecution(currentDateTime);
  if (lastExecution.isPresent()) {
    final ZonedDateTime actual=lastExecution.get();
    final ZonedDateTime expected=ZonedDateTime.of(LocalDateTime.of(2015,12,31,12,00),ZoneId.systemDefault());
    Assert.assertEquals(expected,actual);
  }
}
Program: 4145
Project: 4145
Buggy source:
@Test public void testMustMatchCronEvenIfNanoSecondsVaries(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(QUARTZ);
  CronParser parser=new CronParser(cronDefinition);
  Cron quartzCron=parser.parse("String_Node_Str");
  quartzCron.validate();
  ZonedDateTime zdt=ZonedDateTime.of(1999,07,18,10,00,00,03,ZoneId.systemDefault());
  assertTrue("String_Node_Str",ExecutionTime.forCron(quartzCron).isMatch(zdt));
}

Fixed version (ground truth):
@Test public void testMustMatchCronEvenIfNanoSecondsVaries(){
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(QUARTZ);
  final CronParser parser=new CronParser(cronDefinition);
  final Cron quartzCron=parser.parse("String_Node_Str");
  quartzCron.validate();
  final ZonedDateTime zdt=ZonedDateTime.of(1999,07,18,10,00,00,03,ZoneId.systemDefault());
  assertTrue("String_Node_Str",ExecutionTime.forCron(quartzCron).isMatch(zdt));
}
Program: 4146
Project: 4146
Buggy source:
@Test public void testMatchExact(){
  CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(QUARTZ);
  CronParser parser=new CronParser(cronDefinition);
  Cron quartzCron=parser.parse("String_Node_Str");
  quartzCron.validate();
  ZonedDateTime zdt=ZonedDateTime.of(1999,07,18,10,00,00,00,ZoneId.systemDefault());
  assertTrue("String_Node_Str",ExecutionTime.forCron(quartzCron).isMatch(zdt));
}

Fixed version (ground truth):
@Test public void testMatchExact(){
  final CronDefinition cronDefinition=CronDefinitionBuilder.instanceDefinitionFor(QUARTZ);
  final CronParser parser=new CronParser(cronDefinition);
  final Cron quartzCron=parser.parse("String_Node_Str");
  quartzCron.validate();
  final ZonedDateTime zdt=ZonedDateTime.of(1999,07,18,10,00,00,00,ZoneId.systemDefault());
  assertTrue("String_Node_Str",ExecutionTime.forCron(quartzCron).isMatch(zdt));
}