Program: 79721
Project: 79721
Buggy source:
@Test public void nameQueryShouldBeSupported() throws Exception {
  Context context=mock(Context.class);
  QueryRequest request=mock(QueryRequest.class);
  given(request.getFields()).willReturn(Arrays.asList(new JsonPointer("String_Node_Str")));
  QueryResourceHandler handler=mock(QueryResourceHandler.class);
  ResourceSetDescription resourceSet=mock(ResourceSetDescription.class);
  QueryFilter<JsonPointer> queryFilter=QueryFilter.and(QueryFilter.equalTo(new JsonPointer("String_Node_Str"),"String_Node_Str"),QueryFilter.equalTo(new JsonPointer("String_Node_Str"),"String_Node_Str"),QueryFilter.equalTo(new JsonPointer("String_Node_Str"),"String_Node_Str"));
  Promise<Collection<ResourceSetDescription>,ResourceException> resourceSetsPromise=Promises.newResultPromise((Collection<ResourceSetDescription>)asSet(resourceSet));
  given(contextHelper.getRealm(context)).willReturn("String_Node_Str");
  given(contextHelper.getUserId(context)).willReturn("String_Node_Str");
  given(request.getQueryFilter()).willReturn(queryFilter);
  given(resourceSetService.getResourceSets(eq(context),eq("String_Node_Str"),Matchers.<ResourceSetWithPolicyQuery>anyObject(),eq("String_Node_Str"),eq(false))).willReturn(resourceSetsPromise);
  Promise<QueryResponse,ResourceException> promise=resource.queryCollection(context,request,handler);
  ArgumentCaptor<ResourceSetWithPolicyQuery> queryCaptor=ArgumentCaptor.forClass(ResourceSetWithPolicyQuery.class);
  verify(resourceSetService).getResourceSets(eq(context),eq("String_Node_Str"),queryCaptor.capture(),eq("String_Node_Str"),eq(false));
  assertThat(queryCaptor.getValue().getOperator()).isEqualTo(AggregateQuery.Operator.AND);
  assertThat(queryCaptor.getValue().getPolicyQuery()).isEqualTo(QueryFilter.equalTo("String_Node_Str","String_Node_Str"));
  assertThat(queryCaptor.getValue().getResourceSetQuery()).isEqualTo(QueryFilter.and(QueryFilter.equalTo("String_Node_Str","String_Node_Str"),QueryFilter.equalTo("String_Node_Str","String_Node_Str")));
  assertThat(promise).succeeded().withObject().isNotNull();
}

Fixed version (ground truth):
@Test public void nameQueryShouldBeSupported() throws Exception {
  Context context=mock(Context.class);
  QueryRequest request=mock(QueryRequest.class);
  given(request.getFields()).willReturn(Arrays.asList(new JsonPointer("String_Node_Str")));
  QueryResourceHandler handler=mock(QueryResourceHandler.class);
  ResourceSetDescription resourceSet=mock(ResourceSetDescription.class);
  QueryFilter<JsonPointer> queryFilter=QueryFilter.and(QueryFilter.equalTo(new JsonPointer("String_Node_Str"),"String_Node_Str"),QueryFilter.equalTo(new JsonPointer("String_Node_Str"),"String_Node_Str"),QueryFilter.equalTo(new JsonPointer("String_Node_Str"),"String_Node_Str"));
  Promise<Collection<ResourceSetDescription>,ResourceException> resourceSetsPromise=Promises.newResultPromise((Collection<ResourceSetDescription>)asSet(resourceSet));
  given(contextHelper.getRealm(context)).willReturn("String_Node_Str");
  given(contextHelper.getUserId(context)).willReturn("String_Node_Str");
  given(request.getQueryFilter()).willReturn(queryFilter);
  given(resourceSetService.getResourceSets(eq(context),eq("String_Node_Str"),Matchers.<ResourceSetWithPolicyQuery>anyObject(),eq("String_Node_Str"),eq(false))).willReturn(resourceSetsPromise);
  Promise<QueryResponse,ResourceException> promise=resource.queryCollection(context,request,handler);
  ArgumentCaptor<ResourceSetWithPolicyQuery> queryCaptor=ArgumentCaptor.forClass(ResourceSetWithPolicyQuery.class);
  verify(resourceSetService).getResourceSets(eq(context),eq("String_Node_Str"),queryCaptor.capture(),eq("String_Node_Str"),eq(false));
  assertThat(queryCaptor.getValue().getOperator()).isEqualTo(AggregateQuery.Operator.AND);
  assertThat(queryCaptor.getValue().getPolicyQuery()).isEqualTo(QueryFilter.equalTo(new JsonPointer("String_Node_Str"),"String_Node_Str"));
  assertThat(queryCaptor.getValue().getResourceSetQuery()).isEqualTo(QueryFilter.and(QueryFilter.equalTo("String_Node_Str","String_Node_Str"),QueryFilter.equalTo("String_Node_Str","String_Node_Str")));
  assertThat(promise).succeeded().withObject().isNotNull();
}