use of com.newrelic.agent.instrumentation.methodmatchers.MethodMatcher in project newrelic-java-agent by newrelic.
the class PointCutConfigTest method incrediblyConcisePointcut.
@Test
public void incrediblyConcisePointcut() throws Exception {
final String yaml = "oder:\n java/lang/String.concat(Ljava/lang/String;)Ljava/lang/String;";
PointCutConfig config = new PointCutConfig(new ByteArrayInputStream(yaml.getBytes(StandardCharsets.UTF_8)));
Assert.assertEquals(1, config.getPointCuts().size());
Assert.assertNotNull(config.getPointCuts().get(0));
MethodMatcher methodMatcher = config.getPointCuts().get(0).getMethodMatcher();
ClassMatcher classMatcher = config.getPointCuts().get(0).getClassMatcher();
Assert.assertTrue(classMatcher instanceof ExactClassMatcher);
Assert.assertTrue(classMatcher.isMatch(String.class));
Assert.assertFalse(classMatcher.isMatch(List.class));
Assert.assertTrue(methodMatcher instanceof ExactMethodMatcher);
}
Aggregations