Exemple #1
0
 public void testSetExceptions() throws Exception {
   CtClass cc = sloader.get("test2.SetExceptions");
   CtMethod m = cc.getDeclaredMethod("f");
   CtClass ex = m.getExceptionTypes()[0];
   assertEquals("java.lang.Exception", ex.getName());
   m.setExceptionTypes(null);
   assertEquals(0, m.getExceptionTypes().length);
   m.setExceptionTypes(new CtClass[0]);
   assertEquals(0, m.getExceptionTypes().length);
   m.setExceptionTypes(new CtClass[] {ex});
   assertEquals(ex, m.getExceptionTypes()[0]);
 }