@Override
  public void populateDisplayData(DisplayData.Builder builder) {
    builder
        .add(DisplayData.item("maxAttempts", maxAttempts).withLabel("maxAttempts"))
        .add(DisplayData.item("initialBackoff", initialBackoff).withLabel("initialBackoff"))
        .add(DisplayData.item("samplePeriod", samplePeriod).withLabel("samplePeriod"))
        .add(
            DisplayData.item("samplePeriodBucketSize", samplePeriodBucketSize)
                .withLabel("samplePeriodBucketSize"))
        .add(DisplayData.item("overloadRatio", overloadRatio).withLabel("overloadRatio"))
        .add(DisplayData.item("throttleDuration", throttleDuration).withLabel("throttleDuration"))
        .add(
            DisplayData.item("batchInitialCount", batchInitialCount).withLabel("batchInitialCount"))
        .add(DisplayData.item("batchMaxCount", batchMaxCount).withLabel("batchMaxCount"))
        .add(DisplayData.item("batchMaxBytes", batchMaxBytes).withLabel("batchMaxBytes"))
        .add(
            DisplayData.item("batchTargetLatency", batchTargetLatency)
                .withLabel("batchTargetLatency"))
        .add(
            DisplayData.item("hintMaxNumWorkers", hintMaxNumWorkers).withLabel("hintMaxNumWorkers"))
        .add(
            DisplayData.item("shouldReportDiagnosticMetrics", shouldReportDiagnosticMetrics)
                .withLabel("shouldReportDiagnosticMetrics"));
  }
@Test
  public void populateDisplayData() {
    //noinspection unchecked
    ArgumentCaptor<ItemSpec<?>> captor = ArgumentCaptor.forClass(DisplayData.ItemSpec.class);

    DisplayData.Builder builder = mock(DisplayData.Builder.class);
    when(builder.add(captor.capture())).thenReturn(builder);
    RpcQosOptions rpcQosOptions = RpcQosOptions.defaultOptions();
    rpcQosOptions.populateDisplayData(builder);

    List<String> actualKeys =
        captor.getAllValues().stream().map(ItemSpec::getKey).sorted().collect(Collectors.toList());

    List<String> expectedKeys =
        newArrayList(
            "batchInitialCount",
            "batchMaxBytes",
            "batchMaxCount",
            "batchTargetLatency",
            "hintMaxNumWorkers",
            "initialBackoff",
            "maxAttempts",
            "overloadRatio",
            "samplePeriod",
            "samplePeriodBucketSize",
            "shouldReportDiagnosticMetrics",
            "throttleDuration");

    assertEquals(expectedKeys, actualKeys);
  }