public boolean isAnyServiceErrorListDefined()
  {
    return _serviceErrors != null || _resourceMethodDescriptors.stream()
        .map(ResourceMethodDescriptor::getServiceErrors)
        .anyMatch(Objects::nonNull);
  }
@Test(dataProvider = "isAnyServiceErrorListDefinedData")
  public void testIsAnyServiceErrorListDefined(ServiceError[] resourceLevelServiceErrors,
      ResourceMethodDescriptor[] resourceMethodDescriptors, boolean expected) {
    // Create dummy resource model
    final ResourceModel resourceModel = new ResourceModel(EmptyRecord.class,
                                                          SampleResources.CollectionCollectionResource.class,
                                                          null,
                                                          "collectionCollection",
                                                          ResourceType.COLLECTION,
                                                          "com.linkedin.restli.internal.server.model",
                                                          "collectionCollection");

    // Add resource-level service errors
    if (resourceLevelServiceErrors == null)
    {
      resourceModel.setServiceErrors(null);
    }
    else
    {
      resourceModel.setServiceErrors(Arrays.asList(resourceLevelServiceErrors));
    }

    // Add mock resource method descriptors
    for (ResourceMethodDescriptor resourceMethodDescriptor : resourceMethodDescriptors)
    {
      resourceModel.addResourceMethodDescriptor(resourceMethodDescriptor);
    }

    Assert.assertEquals(expected, resourceModel.isAnyServiceErrorListDefined(),
        "Cannot correctly compute whether resource model defines resource-level or method-level service errors.");
  }