use of com.newrelic.agent.extension.util.XmlException in project newrelic-java-agent by newrelic.
the class ExtensionDomParserTest method testPrimitiveReturnType.
@Test
public void testPrimitiveReturnType() throws Exception {
Extension ext = ExtensionDomParser.readFile(getFile(PRIMITIVE_RETURN_TYPE_FILE_PATH));
Instrumentation inst = ext.getInstrumentation();
List<Pointcut> thePcs = inst.getPointcut();
Assert.assertEquals(1, thePcs.size());
Pointcut pc = thePcs.get(0);
Assert.assertNull(pc.getClassName());
Assert.assertEquals("com.company.SomeInterface", pc.getInterfaceName());
Assert.assertEquals(1, pc.getMethod().size());
Assert.assertEquals("boolean", pc.getMethod().iterator().next().getReturnType());
try {
ExtensionConversionUtility.convertToPointCutsForValidation(ext);
Assert.fail();
} catch (XmlException ex) {
Assert.assertEquals("The return type 'boolean' is not valid. Primitive types are not allowed.", ex.getMessage());
}
}
Aggregations