@Test public void testExtractSignature_with_throws() throws CannotCompileException, NotFoundException { CtClass targetClass = ClassPool.getDefault().makeClass( "Target" + TestCounter.testCounter++); CtMethod fooMethod = CtNewMethod.make("public void foo() throws Exception, Throwable {}", targetClass); targetClass.addMethod(fooMethod); String extractSignature = signatureExtractor.createJavaSignature(fooMethod); assertEquals("public void foo() throws java.lang.Exception, java.lang.Throwable", extractSignature); }
public String createJavaSignature(CtMethod overridenMethod) throws NotFoundException { return extractModifier(overridenMethod) + " " + extractReturnType(overridenMethod) + " " + overridenMethod.getName() + "(" + extractParametersAndTypes(overridenMethod) + ")" + extractThrowClause(overridenMethod); }
CtMethodJavaWriter { public String createJavaSignature(CtMethod overridenMethod) throws NotFoundException { return extractModifier(overridenMethod) + " " + extractReturnType(overridenMethod) + " " + overridenMethod.getName() + "(" + extractParametersAndTypes(overridenMethod) + ")" + extractThrowClause(overridenMethod); } }
CtMethodJavaWriter { public String createJavaSignature(CtMethod overridenMethod) throws NotFoundException { return extractModifier(overridenMethod) + " " + extractReturnType(overridenMethod) + " " + overridenMethod.getName() + "(" + extractParametersAndTypes(overridenMethod) + ")" + extractThrowClause(overridenMethod); }  }
CtMethodJavaWriter { public String createJavaSignature(CtMethod overridenMethod) throws NotFoundException { return extractModifier(overridenMethod) + " " + extractReturnType(overridenMethod) + " " + overridenMethod.getName() + "(" + extractParametersAndTypes(overridenMethod) + ")" + extractThrowClause(overridenMethod); }  String createJavaSignature(CtMethod overridenMethod); String invokeSuper(CtMethod method); }
CtMethodJavaWriter { public String createJavaSignature(CtMethod overridenMethod) throws NotFoundException { return extractModifier(overridenMethod) + " " + extractReturnType(overridenMethod) + " " + overridenMethod.getName() + "(" + extractParametersAndTypes(overridenMethod) + ")" + extractThrowClause(overridenMethod); }  String createJavaSignature(CtMethod overridenMethod); String invokeSuper(CtMethod method);  }