### Question:
MetricAdapter { @SuppressWarnings("MixedMutabilityReturnType") static List<StringKeyValue> toProtoLabels(Labels labels) { if (labels.isEmpty()) { return Collections.emptyList(); } final List<StringKeyValue> result = new ArrayList<>(labels.size()); labels.forEach( new LabelConsumer() { @Override public void consume(String key, String value) { result.add(StringKeyValue.newBuilder().setKey(key).setValue(value).build()); } }); return result; } private  MetricAdapter();   }### Answer:
@Test void toProtoLabels() { assertThat(MetricAdapter.toProtoLabels(Labels.empty())).isEmpty(); assertThat(MetricAdapter.toProtoLabels(Labels.of("k", "v"))) .containsExactly(StringKeyValue.newBuilder().setKey("k").setValue("v").build()); assertThat(MetricAdapter.toProtoLabels(Labels.of("k1", "v1", "k2", "v2"))) .containsExactly( StringKeyValue.newBuilder().setKey("k1").setValue("v1").build(), StringKeyValue.newBuilder().setKey("k2").setValue("v2").build()); }