Improve tests readability moving common instance to test class
MODIFY
dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/WeakMapTest.groovy
dd-java-agent/agent-bootstrap/src/test/groovy/datadog/trace/bootstrap/WeakMapTest.groovy
@@ -4,12 +4,11 @@ import spock.lang.Specification
class WeakMapTest extends Specification {
-
- def "getOrCreate a value"() {
- setup:
def supplier = new CounterSupplier()
+
def sut = new WeakMap.MapAdapter<String, Integer>(new WeakHashMap<>())
+ def "getOrCreate a value"() {
when:
def count = sut.getOrCreate('key', supplier)
@@ -19,10 +18,6 @@ class WeakMapTest extends Specification {
}
def "getOrCreate a value multiple times same class loader same key"() {
- setup:
- def supplier = new CounterSupplier()
- def sut = new WeakMap.MapAdapter<String, Integer>(new WeakHashMap<>())
-
when:
def count1 = sut.getOrCreate('key', supplier)
def count2 = sut.getOrCreate('key', supplier)
@@ -34,10 +29,6 @@ class WeakMapTest extends Specification {
}
def "getOrCreate a value multiple times same class loader different keys"() {
- setup:
- def supplier = new CounterSupplier()
- def sut = new WeakMap.MapAdapter<String, Integer>(new WeakHashMap<>())
-
when:
def count1 = sut.getOrCreate('key1', supplier)
def count2 = sut.getOrCreate('key2', supplier)

MODIFY
dd-java-agent/instrumentation/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/AttributeKeys.java
dd-java-agent/instrumentation/netty-4.1/src/main/java/datadog/trace/instrumentation/netty41/AttributeKeys.java
@@ -6,7 +6,6 @@ import datadog.trace.instrumentation.netty41.client.HttpClientTracingHandler;
import datadog.trace.instrumentation.netty41.server.HttpServerTracingHandler;
import io.netty.util.AttributeKey;
import io.opentracing.Span;
-
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

Improve tests readability moving common instance to test class