@Test
public void testFindMethod() {

  final CtClass ctclass = ClassPool.getDefault().makeClass("testFindMethodClass");
  addNewMethod(ctclass, "method1");
  addNewMethod(ctclass, "method2");
  Method m = null;
  try {
    m = FindMethodTest.class.getMethod("method1");
  } catch (NoSuchMethodException | SecurityException e1) {
    e1.printStackTrace();
    return;
  }
  try {
    final CtMethod foundMethod = JavassistUtils.findMethod(ctclass, m);
    Assert.assertEquals("method1", foundMethod.getName());
  } catch (final NotFoundException e) {
    e.printStackTrace();
    fail("Could not find method in CtClass");
  }
}