Program: 185284
Project: 185284
Buggy source:
/** 
 * Tests whether queries looking for some type declaration with a name pattern like '*Tests' works correctly.
 */
@Test public void testFindClassDeclarationWithPattern() throws Exception {
  int matchRule=SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
  SearchPattern testPattern=SearchPattern.createPattern("String_Node_Str",IJavaSearchConstants.TYPE,IJavaSearchConstants.DECLARATIONS,matchRule);
  GroovyCompilationUnit songTests=createUnit("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  GroovyCompilationUnit weirdTests=createUnit("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  GroovyCompilationUnit artistTests=createUnit("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  IJavaProject javaProject=JavaCore.create(project);
  IType songTestsType=javaProject.findType("String_Node_Str");
  assertNotNull(songTestsType);
  IType artistTestsType=javaProject.findType("String_Node_Str");
  assertNotNull(artistTestsType);
  SearchParticipant[] searchParticipants=new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()};
  final ArrayList<Object> result=new ArrayList<>();
  IJavaSearchScope scope=SearchEngine.createJavaSearchScope(new IJavaElement[]{songTests,weirdTests,artistTests},IJavaSearchScope.SOURCES);
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match) throws CoreException {
      Object element=match.getElement();
      result.add(element);
    }
  }
;
  new SearchEngine().search(testPattern,searchParticipants,scope,requestor,new NullProgressMonitor());
  assertEquals("String_Node_Str",2,result.size());
  assertElements(new HashSet<>(result),songTestsType,artistTestsType);
}

Fixed version (ground truth):
/** 
 * Tests whether queries looking for some type declaration with a name pattern like '*Tests' works correctly.
 */
@Test public void testFindClassDeclarationWithPattern() throws Exception {
  int matchRule=SearchPattern.R_EXACT_MATCH | SearchPattern.R_CASE_SENSITIVE;
  SearchPattern testPattern=SearchPattern.createPattern("String_Node_Str",IJavaSearchConstants.TYPE,IJavaSearchConstants.DECLARATIONS,matchRule);
  GroovyCompilationUnit songTests=createUnit("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  GroovyCompilationUnit weirdTests=createUnit("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  GroovyCompilationUnit artistTests=createUnit("String_Node_Str","String_Node_Str","String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str");
  IJavaProject javaProject=JavaCore.create(project);
  IType songTestsType=javaProject.findType("String_Node_Str");
  assertNotNull(songTestsType);
  IType artistTestsType=javaProject.findType("String_Node_Str");
  assertNotNull(artistTestsType);
  SearchParticipant[] searchParticipants=new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()};
  final List<Object> result=new ArrayList<>();
  IJavaSearchScope scope=SearchEngine.createJavaSearchScope(new IJavaElement[]{songTests,weirdTests,artistTests},IJavaSearchScope.SOURCES);
  SearchRequestor requestor=new SearchRequestor(){
    @Override public void acceptSearchMatch(    SearchMatch match) throws CoreException {
      Object element=match.getElement();
      result.add(element);
    }
  }
;
  new SearchEngine().search(testPattern,searchParticipants,scope,requestor,new NullProgressMonitor());
  assertEquals("String_Node_Str",2,result.size());
  assertElements(new HashSet<>(result),songTestsType,artistTestsType);
}