我认为您在进行后续查询时走在了正确的轨道上。但是,您无法查询 Ref。但是,由于您有 ref,并且可能也有 TestCase JsonObject,因此您可以执行以下操作,您可以查询父 TestCase 的 FormattedID:
// Query for Test Case to which we want to add results
QueryRequest testCaseRequest = new QueryRequest("TestCase");
testCaseRequest.setFetch(new Fetch("FormattedID","Name"));
testCaseRequest.setQueryFilter(new QueryFilter("FormattedID", "=", "TC4"));
QueryResponse testCaseQueryResponse = restApi.query(testCaseRequest);
JsonObject testCaseJsonObject = testCaseQueryResponse.getResults().get(0).getAsJsonObject();
String testCaseRef = testCaseQueryResponse.getResults().get(0).getAsJsonObject().get("_ref").toString();
String testCaseFormattedID = testCaseQueryResponse.getResults().get(0).getAsJsonObject.get("FormattedID").toString();
// Query for Test Case Results that are associated to this particular Test Case
QueryRequest testCaseResultsRequest = new QueryRequest("TestCaseResult");
testCaseResultsRequest.setFetch(new Fetch("Build","TestCase","Verdict","FormattedID"));
testCaseResultsRequest.setQueryFilter(new QueryFilter("TestCase.FormattedID", "=", testCaseFormattedID));
QueryResponse testCaseResultResponse = restApi.query(testCaseResultsRequest);
int numberTestCaseResults = testCaseResultResponse.getTotalResultCount();