我无法使用“||”进行切入点 运算符和多个注释。我正在尝试为一些 JBehave 注释(@Given、@Then、@When)创建切入点。
这工作正常:
@Pointcut("@annotation(given)")
public void jBehaveGivenPointcut(Given given) { }
Run Code Online (Sandbox Code Playgroud)
如果我围绕它创造并提出建议,它也会起作用。
为这三个注释创建切入点的语法是什么?由于我在其他切入点中使用了逻辑 OR 运算符,因此我认为它类似于:
@Pointcut("@annotation(given) || @annotation(then) || @annotation(when) ")
public void jBehaveGivenPointcut(Given given, Then then, When when) { }
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我收到不一致的绑定异常。我尝试了其他组合,但找不到有效的组合。