Migrate CallDepthThreadLocalMapTest to Java.
DELETE
javaagent-api/src/test/groovy/io/opentelemetry/javaagent/instrumentation/api/CallDepthThreadLocalMapTest.groovy
-/*
- * Copyright The OpenTelemetry Authors
- * SPDX-License-Identifier: Apache-2.0
- */
-
-package io.opentelemetry.javaagent.instrumentation.api
-
-import spock.lang.Specification
-
-class CallDepthThreadLocalMapTest extends Specification {
-
- def "test CallDepthThreadLocalMap"() {
- setup:
- Class<?> k1 = String
- Class<?> k2 = Integer
- Class<?> k3 = Double
-
- expect:
- CallDepthThreadLocalMap.incrementCallDepth(k1) == 0
- CallDepthThreadLocalMap.incrementCallDepth(k2) == 0
-
- CallDepthThreadLocalMap.incrementCallDepth(k1) == 1
- CallDepthThreadLocalMap.incrementCallDepth(k2) == 1
-
- when:
- CallDepthThreadLocalMap.reset(k1)
-
- then:
- CallDepthThreadLocalMap.incrementCallDepth(k2) == 2
-
- when:
- CallDepthThreadLocalMap.reset(k2)
-
- then:
- CallDepthThreadLocalMap.incrementCallDepth(k1) == 0
- CallDepthThreadLocalMap.incrementCallDepth(k2) == 0
-
- CallDepthThreadLocalMap.incrementCallDepth(k1) == 1
- CallDepthThreadLocalMap.incrementCallDepth(k2) == 1
-
- expect:
- CallDepthThreadLocalMap.decrementCallDepth(k1) == 1
- CallDepthThreadLocalMap.decrementCallDepth(k2) == 1
-
- CallDepthThreadLocalMap.decrementCallDepth(k1) == 0
- CallDepthThreadLocalMap.decrementCallDepth(k2) == 0
-
- and:
- CallDepthThreadLocalMap.incrementCallDepth(k3) == 0
- CallDepthThreadLocalMap.decrementCallDepth(k3) == 0
-
- }
-}

ADD
javaagent-api/src/test/java/io/opentelemetry/javaagent/instrumentation/api/CallDepthThreadLocalMapTest.java
+/*
+ * Copyright The OpenTelemetry Authors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+package io.opentelemetry.javaagent.instrumentation.api;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.jupiter.api.Test;
+
+class CallDepthThreadLocalMapTest {
+
+ @Test
+ void incrementDecrement() {
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(String.class)).isZero();
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(Integer.class)).isZero();
+
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(String.class)).isOne();
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(Integer.class)).isOne();
+
+ CallDepthThreadLocalMap.reset(String.class);
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(Integer.class)).isEqualTo(2);
+
+ CallDepthThreadLocalMap.reset(Integer.class);
+
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(String.class)).isZero();
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(Integer.class)).isZero();
+
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(String.class)).isOne();
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(Integer.class)).isOne();
+
+ assertThat(CallDepthThreadLocalMap.decrementCallDepth(String.class)).isOne();
+ assertThat(CallDepthThreadLocalMap.decrementCallDepth(Integer.class)).isOne();
+
+ assertThat(CallDepthThreadLocalMap.decrementCallDepth(String.class)).isZero();
+ assertThat(CallDepthThreadLocalMap.decrementCallDepth(Integer.class)).isZero();
+
+ assertThat(CallDepthThreadLocalMap.incrementCallDepth(Double.class)).isZero();
+ assertThat(CallDepthThreadLocalMap.decrementCallDepth(Double.class)).isZero();
+ }
+}

RENAME
javaagent-api/src/test/groovy/io/opentelemetry/javaagent/instrumentation/api/instrumenter/PeerServiceAttributesExtractorTest.java
javaagent-api/src/test/java/io/opentelemetry/javaagent/instrumentation/api/instrumenter/PeerServiceAttributesExtractorTest.java
Migrate CallDepthThreadLocalMapTest to Java. (#3331)