Uncomment and fix JAX-RS default method tests (#2930)
This commit is contained in:
parent
1086bce0b0
commit
8379404ae8
|
@ -8,10 +8,8 @@ package io.opentelemetry.javaagent.instrumentation.apachecamel;
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface;
|
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface;
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
@ -51,7 +49,7 @@ public class ApacheCamelInstrumentationModule extends InstrumentationModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
return not(isAbstract()).and(implementsInterface(named("org.apache.camel.CamelContext")));
|
return implementsInterface(named("org.apache.camel.CamelContext"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
package io.opentelemetry.javaagent.instrumentation.grizzly;
|
package io.opentelemetry.javaagent.instrumentation.grizzly;
|
||||||
|
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
|
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass;
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -28,7 +28,7 @@ public class HttpHandlerInstrumentation implements TypeInstrumentation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
return safeHasSuperType(named("org.glassfish.grizzly.http.server.HttpHandler"));
|
return extendsClass(named("org.glassfish.grizzly.http.server.HttpHandler"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
package io.opentelemetry.javaagent.instrumentation.grpc.v1_6;
|
package io.opentelemetry.javaagent.instrumentation.grpc.v1_6;
|
||||||
|
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
|
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass;
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -31,7 +31,7 @@ public class GrpcServerBuilderInstrumentation implements TypeInstrumentation {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
return safeHasSuperType(named("io.grpc.ServerBuilder"));
|
return extendsClass(named("io.grpc.ServerBuilder"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,7 +45,7 @@ class JaxRsAnnotations1InstrumentationTest extends AgentInstrumentationSpecifica
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unroll
|
@Unroll
|
||||||
def "span named '#paramName' from annotations on class when is not root span"() {
|
def "span named '#paramName' from annotations on class '#className' when is not root span"() {
|
||||||
setup:
|
setup:
|
||||||
runUnderServerTrace("test") {
|
runUnderServerTrace("test") {
|
||||||
obj.call()
|
obj.call()
|
||||||
|
@ -128,8 +128,7 @@ class JaxRsAnnotations1InstrumentationTest extends AgentInstrumentationSpecifica
|
||||||
}
|
}
|
||||||
"/child/call" | new ChildClassWithPath()
|
"/child/call" | new ChildClassWithPath()
|
||||||
"/child/call" | new JavaInterfaces.ChildClassOnInterface()
|
"/child/call" | new JavaInterfaces.ChildClassOnInterface()
|
||||||
// TODO: uncomment when we drop support for Java 7
|
"/child/call" | new JavaInterfaces.DefaultChildClassOnInterface()
|
||||||
// "/child/invoke" | new JavaInterfaces.DefaultChildClassOnInterface()
|
|
||||||
|
|
||||||
className = getClassName(obj.class)
|
className = getClassName(obj.class)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class JavaInterfaces {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("abstract")
|
@Path("abstract")
|
||||||
abstract class AbstractClassOnInterfaceWithClassPath implements InterfaceWithClassMethodPath {
|
abstract static class AbstractClassOnInterfaceWithClassPath
|
||||||
|
implements InterfaceWithClassMethodPath {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("call")
|
@Path("call")
|
||||||
|
@ -36,7 +37,7 @@ public class JavaInterfaces {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("child")
|
@Path("child")
|
||||||
class ChildClassOnInterface extends AbstractClassOnInterfaceWithClassPath {
|
static class ChildClassOnInterface extends AbstractClassOnInterfaceWithClassPath {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void actual() {
|
void actual() {
|
||||||
|
@ -44,25 +45,25 @@ public class JavaInterfaces {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: uncomment when we drop support for Java 7
|
@Path("interface")
|
||||||
// @Path("interface")
|
interface DefaultInterfaceWithClassMethodPath extends Jax {
|
||||||
// interface DefaultInterfaceWithClassMethodPath extends Jax {
|
|
||||||
//
|
@Override
|
||||||
// @GET
|
@GET
|
||||||
// @Path("invoke")
|
@Path("call")
|
||||||
// default void call() {
|
default void call() {
|
||||||
// actual();
|
actual();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// void actual();
|
void actual();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Path("child")
|
@Path("child")
|
||||||
// class DefaultChildClassOnInterface implements DefaultInterfaceWithClassMethodPath {
|
static class DefaultChildClassOnInterface implements DefaultInterfaceWithClassMethodPath {
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void actual() {
|
public void actual() {
|
||||||
// // do nothing
|
// do nothing
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ abstract class JaxRsAnnotationsInstrumentationTest extends AgentInstrumentationS
|
||||||
}
|
}
|
||||||
|
|
||||||
@Unroll
|
@Unroll
|
||||||
def "span named '#paramName' from annotations on class when is not root span"() {
|
def "span named '#paramName' from annotations on class '#className' when is not root span"() {
|
||||||
setup:
|
setup:
|
||||||
runUnderServerTrace("test") {
|
runUnderServerTrace("test") {
|
||||||
obj.call()
|
obj.call()
|
||||||
|
@ -128,8 +128,7 @@ abstract class JaxRsAnnotationsInstrumentationTest extends AgentInstrumentationS
|
||||||
}
|
}
|
||||||
"/child/call" | new ChildClassWithPath()
|
"/child/call" | new ChildClassWithPath()
|
||||||
"/child/call" | new JavaInterfaces.ChildClassOnInterface()
|
"/child/call" | new JavaInterfaces.ChildClassOnInterface()
|
||||||
// TODO: uncomment when we drop support for Java 7
|
"/child/call" | new JavaInterfaces.DefaultChildClassOnInterface()
|
||||||
// "GET /child/invoke" | new JavaInterfaces.DefaultChildClassOnInterface()
|
|
||||||
|
|
||||||
className = getClassName(obj.class)
|
className = getClassName(obj.class)
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class JavaInterfaces {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("abstract")
|
@Path("abstract")
|
||||||
abstract class AbstractClassOnInterfaceWithClassPath implements InterfaceWithClassMethodPath {
|
abstract static class AbstractClassOnInterfaceWithClassPath
|
||||||
|
implements InterfaceWithClassMethodPath {
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("call")
|
@Path("call")
|
||||||
|
@ -36,7 +37,7 @@ public class JavaInterfaces {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Path("child")
|
@Path("child")
|
||||||
class ChildClassOnInterface extends AbstractClassOnInterfaceWithClassPath {
|
static class ChildClassOnInterface extends AbstractClassOnInterfaceWithClassPath {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void actual() {
|
void actual() {
|
||||||
|
@ -44,25 +45,25 @@ public class JavaInterfaces {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: uncomment when we drop support for Java 7
|
@Path("interface")
|
||||||
// @Path("interface")
|
interface DefaultInterfaceWithClassMethodPath extends Jax {
|
||||||
// interface DefaultInterfaceWithClassMethodPath extends Jax {
|
|
||||||
//
|
@Override
|
||||||
// @GET
|
@GET
|
||||||
// @Path("invoke")
|
@Path("call")
|
||||||
// default void call() {
|
default void call() {
|
||||||
// actual();
|
actual();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// void actual();
|
void actual();
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// @Path("child")
|
@Path("child")
|
||||||
// class DefaultChildClassOnInterface implements DefaultInterfaceWithClassMethodPath {
|
static class DefaultChildClassOnInterface implements DefaultInterfaceWithClassMethodPath {
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void actual() {
|
public void actual() {
|
||||||
// // do nothing
|
// do nothing
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
package io.opentelemetry.javaagent.instrumentation.khttp;
|
package io.opentelemetry.javaagent.instrumentation.khttp;
|
||||||
|
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
|
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.extendsClass;
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
|
@ -45,7 +45,7 @@ public class KHttpInstrumentationModule extends InstrumentationModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
return safeHasSuperType(named("khttp.KHttp"));
|
return extendsClass(named("khttp.KHttp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,14 +5,12 @@
|
||||||
|
|
||||||
package io.opentelemetry.javaagent.instrumentation.vertx;
|
package io.opentelemetry.javaagent.instrumentation.vertx;
|
||||||
|
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
|
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.implementsInterface;
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.hasClassesNamed;
|
||||||
import static java.util.Collections.singletonList;
|
import static java.util.Collections.singletonList;
|
||||||
import static java.util.Collections.singletonMap;
|
import static java.util.Collections.singletonMap;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
@ -47,7 +45,7 @@ public class VertxWebInstrumentationModule extends InstrumentationModule {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ElementMatcher<TypeDescription> typeMatcher() {
|
public ElementMatcher<TypeDescription> typeMatcher() {
|
||||||
return not(isInterface()).and(safeHasSuperType(named("io.vertx.ext.web.Route")));
|
return implementsInterface(named("io.vertx.ext.web.Route"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,8 +25,7 @@ public final class AgentElementMatchers {
|
||||||
|
|
||||||
public static ElementMatcher.Junction<TypeDescription> implementsInterface(
|
public static ElementMatcher.Junction<TypeDescription> implementsInterface(
|
||||||
ElementMatcher<TypeDescription> matcher) {
|
ElementMatcher<TypeDescription> matcher) {
|
||||||
return not(isInterface())
|
return new SafeHasSuperTypeMatcher(new SafeErasureMatcher<>(matcher), true);
|
||||||
.and(new SafeHasSuperTypeMatcher(new SafeErasureMatcher<>(matcher), true));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ElementMatcher.Junction<TypeDescription> hasInterface(
|
public static ElementMatcher.Junction<TypeDescription> hasInterface(
|
||||||
|
@ -36,8 +35,7 @@ public final class AgentElementMatchers {
|
||||||
|
|
||||||
public static ElementMatcher.Junction<TypeDescription> safeHasSuperType(
|
public static ElementMatcher.Junction<TypeDescription> safeHasSuperType(
|
||||||
ElementMatcher<TypeDescription> matcher) {
|
ElementMatcher<TypeDescription> matcher) {
|
||||||
return not(isInterface())
|
return new SafeHasSuperTypeMatcher(new SafeErasureMatcher<>(matcher), false);
|
||||||
.and(new SafeHasSuperTypeMatcher(new SafeErasureMatcher<>(matcher), false));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -7,7 +7,9 @@ package io.opentelemetry.javaagent.tooling.context;
|
||||||
|
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
|
import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.safeHasSuperType;
|
||||||
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.BOOTSTRAP_CLASSLOADER;
|
import static io.opentelemetry.javaagent.extension.matcher.ClassLoaderMatcher.BOOTSTRAP_CLASSLOADER;
|
||||||
|
import static net.bytebuddy.matcher.ElementMatchers.isAbstract;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
|
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||||
|
|
||||||
import io.opentelemetry.instrumentation.api.caching.Cache;
|
import io.opentelemetry.instrumentation.api.caching.Cache;
|
||||||
import io.opentelemetry.instrumentation.api.config.Config;
|
import io.opentelemetry.instrumentation.api.config.Config;
|
||||||
|
@ -385,7 +387,7 @@ public class FieldBackedProvider implements InstrumentationContextProvider {
|
||||||
*/
|
*/
|
||||||
builder =
|
builder =
|
||||||
builder
|
builder
|
||||||
.type(safeHasSuperType(named(entry.getKey())))
|
.type(not(isAbstract()).and(safeHasSuperType(named(entry.getKey()))))
|
||||||
.and(safeToInjectFieldsMatcher())
|
.and(safeToInjectFieldsMatcher())
|
||||||
.and(ActualInstrumentationExtensionImplementation.NOT_DECORATOR_MATCHER)
|
.and(ActualInstrumentationExtensionImplementation.NOT_DECORATOR_MATCHER)
|
||||||
.transform(NoOpTransformer.INSTANCE);
|
.transform(NoOpTransformer.INSTANCE);
|
||||||
|
|
|
@ -10,10 +10,13 @@ import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named
|
import static net.bytebuddy.matcher.ElementMatchers.named
|
||||||
|
|
||||||
import io.opentelemetry.javaagent.tooling.AgentTooling
|
import io.opentelemetry.javaagent.tooling.AgentTooling
|
||||||
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.*
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.A
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.B
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.E
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.F
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.G
|
||||||
import net.bytebuddy.description.type.TypeDescription
|
import net.bytebuddy.description.type.TypeDescription
|
||||||
import net.bytebuddy.description.type.TypeList
|
import net.bytebuddy.description.type.TypeList
|
||||||
import net.bytebuddy.jar.asm.Opcodes
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
|
@ -57,7 +60,6 @@ class HasInterfaceMatcherTest extends Specification {
|
||||||
then:
|
then:
|
||||||
!result // default to false
|
!result // default to false
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
1 * type.getModifiers() >> Opcodes.ACC_ABSTRACT
|
|
||||||
1 * type.isInterface() >> true
|
1 * type.isInterface() >> true
|
||||||
1 * type.asGenericType() >> typeGeneric
|
1 * type.asGenericType() >> typeGeneric
|
||||||
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
||||||
|
|
|
@ -9,10 +9,13 @@ import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named
|
import static net.bytebuddy.matcher.ElementMatchers.named
|
||||||
|
|
||||||
import io.opentelemetry.javaagent.tooling.AgentTooling
|
import io.opentelemetry.javaagent.tooling.AgentTooling
|
||||||
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.*
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.A
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.B
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.E
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.F
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.G
|
||||||
import net.bytebuddy.description.type.TypeDescription
|
import net.bytebuddy.description.type.TypeDescription
|
||||||
import net.bytebuddy.description.type.TypeList
|
import net.bytebuddy.description.type.TypeList
|
||||||
import net.bytebuddy.jar.asm.Opcodes
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
|
@ -28,10 +31,10 @@ class ImplementsInterfaceMatcherTest extends Specification {
|
||||||
|
|
||||||
where:
|
where:
|
||||||
matcherClass | type | result
|
matcherClass | type | result
|
||||||
A | A | false
|
A | A | true
|
||||||
A | B | false
|
A | B | true
|
||||||
B | A | false
|
B | A | false
|
||||||
A | E | false
|
A | E | true
|
||||||
A | F | true
|
A | F | true
|
||||||
A | G | true
|
A | G | true
|
||||||
F | A | false
|
F | A | false
|
||||||
|
@ -54,7 +57,6 @@ class ImplementsInterfaceMatcherTest extends Specification {
|
||||||
then:
|
then:
|
||||||
!result // default to false
|
!result // default to false
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
1 * type.getModifiers() >> Opcodes.ACC_ABSTRACT
|
|
||||||
1 * type.isInterface() >> true
|
1 * type.isInterface() >> true
|
||||||
1 * type.asGenericType() >> typeGeneric
|
1 * type.asGenericType() >> typeGeneric
|
||||||
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
||||||
|
@ -79,7 +81,6 @@ class ImplementsInterfaceMatcherTest extends Specification {
|
||||||
then:
|
then:
|
||||||
!result // default to false
|
!result // default to false
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
1 * type.getModifiers() >> Opcodes.ACC_ABSTRACT
|
|
||||||
1 * type.isInterface() >> true
|
1 * type.isInterface() >> true
|
||||||
1 * type.asGenericType() >> typeGeneric
|
1 * type.asGenericType() >> typeGeneric
|
||||||
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
||||||
|
|
|
@ -9,10 +9,13 @@ import static io.opentelemetry.javaagent.extension.matcher.AgentElementMatchers.
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named
|
import static net.bytebuddy.matcher.ElementMatchers.named
|
||||||
|
|
||||||
import io.opentelemetry.javaagent.tooling.AgentTooling
|
import io.opentelemetry.javaagent.tooling.AgentTooling
|
||||||
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.*
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.A
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.B
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.E
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.F
|
||||||
|
import io.opentelemetry.javaagent.tooling.bytebuddy.matcher.testclasses.G
|
||||||
import net.bytebuddy.description.type.TypeDescription
|
import net.bytebuddy.description.type.TypeDescription
|
||||||
import net.bytebuddy.description.type.TypeList
|
import net.bytebuddy.description.type.TypeList
|
||||||
import net.bytebuddy.jar.asm.Opcodes
|
|
||||||
import spock.lang.Shared
|
import spock.lang.Shared
|
||||||
import spock.lang.Specification
|
import spock.lang.Specification
|
||||||
|
|
||||||
|
@ -28,10 +31,10 @@ class SafeHasSuperTypeMatcherTest extends Specification {
|
||||||
|
|
||||||
where:
|
where:
|
||||||
matcherClass | type | result
|
matcherClass | type | result
|
||||||
A | A | false
|
A | A | true
|
||||||
A | B | false
|
A | B | true
|
||||||
B | A | false
|
B | A | false
|
||||||
A | E | false
|
A | E | true
|
||||||
A | F | true
|
A | F | true
|
||||||
B | G | true
|
B | G | true
|
||||||
F | A | false
|
F | A | false
|
||||||
|
@ -54,7 +57,6 @@ class SafeHasSuperTypeMatcherTest extends Specification {
|
||||||
then:
|
then:
|
||||||
!result // default to false
|
!result // default to false
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
1 * type.getModifiers() >> Opcodes.ACC_ABSTRACT
|
|
||||||
1 * type.asGenericType() >> typeGeneric
|
1 * type.asGenericType() >> typeGeneric
|
||||||
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
1 * typeGeneric.asErasure() >> { throw new Exception("asErasure exception") }
|
||||||
1 * typeGeneric.getTypeName() >> "typeGeneric-name"
|
1 * typeGeneric.getTypeName() >> "typeGeneric-name"
|
||||||
|
@ -78,7 +80,6 @@ class SafeHasSuperTypeMatcherTest extends Specification {
|
||||||
then:
|
then:
|
||||||
!result // default to false
|
!result // default to false
|
||||||
noExceptionThrown()
|
noExceptionThrown()
|
||||||
1 * type.getModifiers() >> Opcodes.ACC_ABSTRACT
|
|
||||||
1 * type.getInterfaces() >> interfaces
|
1 * type.getInterfaces() >> interfaces
|
||||||
1 * interfaces.iterator() >> it
|
1 * interfaces.iterator() >> it
|
||||||
1 * type.asGenericType() >> typeGeneric
|
1 * type.asGenericType() >> typeGeneric
|
||||||
|
|
Loading…
Reference in New Issue