private boolean isTestConstruct(ConstructId _cid) { com.sap.psr.vulas.ConstructId c = JavaId.toCoreType(_cid); return c instanceof JavaMethodId && ((JavaMethodId)c).isTestMethod(); }
/** * Returns true if the given {@link ConstructId} is neither part of the application nor a test method, false otherwise. * @param _jid * @return */ public boolean isLibConstruct(ConstructId _jid) { boolean is_lib_construct = false; // We only instrument clinit, methods and constructors if(ConstructIdUtil.isOfInstrumentableType(_jid)) { final ConstructId context = _jid.getDefinitionContext(); is_lib_construct = this.appConstructs!=null && !this.appConstructs.contains(context); // Not part of the app, now check that is not a JUnit test method of the app if(is_lib_construct) { if(_jid instanceof JavaMethodId) { is_lib_construct = !((JavaMethodId)_jid).isTestMethod(); } } } else { ConstructIdUtil.getLog().error("Expected <CLINIT>, method or constructor, got [" + _jid.toString() + "]"); } return is_lib_construct; }