From 035dad3f402595155c64795305607993f16a2d79 Mon Sep 17 00:00:00 2001 From: "gary.wgy" Date: Fri, 24 May 2024 17:49:19 +0800 Subject: [PATCH] apply spotless --- .../grpc/v1_6/MetadataSetterTest.java | 39 +++++++++++-------- .../grpc/v1_6/propagator/GrpcPropagator.java | 36 +++++++++-------- 2 files changed, 42 insertions(+), 33 deletions(-) diff --git a/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/MetadataSetterTest.java b/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/MetadataSetterTest.java index 4d2d28789e37..7923d0666a4f 100644 --- a/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/MetadataSetterTest.java +++ b/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/MetadataSetterTest.java @@ -1,27 +1,32 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package io.opentelemetry.instrumentation.grpc.v1_6; -import io.opentelemetry.context.Context; +import static org.junit.Assert.assertTrue; + import io.grpc.Metadata; +import io.opentelemetry.context.Context; import io.opentelemetry.instrumentation.grpc.v1_6.propagator.GrpcPropagator; import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertTrue; - class MetadataSetterTest { - @Test - void checkThatIterableSizeEqualsOne() { - GrpcPropagator tested = new GrpcPropagator(); - Metadata metadata = new Metadata(); - tested.inject(Context.current(), metadata, MetadataSetter.INSTANCE); + @Test + void checkThatIterableSizeEqualsOne() { + GrpcPropagator tested = new GrpcPropagator(); + Metadata metadata = new Metadata(); + tested.inject(Context.current(), metadata, MetadataSetter.INSTANCE); - int size = 0; - for (String s : metadata.getAll( - Metadata.Key.of(GrpcPropagator.FIELD, Metadata.ASCII_STRING_MARSHALLER))) { - if (s != null) { - size++; - } - } - assertTrue(size == 1); + int size = 0; + for (String s : + metadata.getAll(Metadata.Key.of(GrpcPropagator.FIELD, Metadata.ASCII_STRING_MARSHALLER))) { + if (s != null) { + size++; + } } -} \ No newline at end of file + assertTrue(size == 1); + } +} diff --git a/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/propagator/GrpcPropagator.java b/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/propagator/GrpcPropagator.java index 341c7248dff5..7e0f8e37dc89 100644 --- a/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/propagator/GrpcPropagator.java +++ b/instrumentation/grpc-1.6/library/src/test/java/io/opentelemetry/instrumentation/grpc/v1_6/propagator/GrpcPropagator.java @@ -1,32 +1,36 @@ +/* + * Copyright The OpenTelemetry Authors + * SPDX-License-Identifier: Apache-2.0 + */ + package io.opentelemetry.instrumentation.grpc.v1_6.propagator; import io.opentelemetry.context.Context; import io.opentelemetry.context.propagation.TextMapGetter; import io.opentelemetry.context.propagation.TextMapPropagator; import io.opentelemetry.context.propagation.TextMapSetter; - import java.util.Collections; import java.util.List; public class GrpcPropagator implements TextMapPropagator { - public static final String FIELD = "X-grpc-field"; - private static final String METADATA = "value"; + public static final String FIELD = "X-grpc-field"; + private static final String METADATA = "value"; - @Override - public List fields() { - return Collections.singletonList(FIELD); - } + @Override + public List fields() { + return Collections.singletonList(FIELD); + } - @Override - public void inject(Context context, C carrier, TextMapSetter setter) { - for (int i = 0; i < 2; i++) { - setter.set(carrier, FIELD, METADATA); - } + @Override + public void inject(Context context, C carrier, TextMapSetter setter) { + for (int i = 0; i < 2; i++) { + setter.set(carrier, FIELD, METADATA); } + } - @Override - public Context extract(Context context, C carrier, TextMapGetter getter) { - return context; - } + @Override + public Context extract(Context context, C carrier, TextMapGetter getter) { + return context; + } }