Pros:
  - instrumentation let's you asses runtime behavior of a program which is what we are after in most cases when doing functional testing of the optimizer
  - since you are counting method invocations you are less concerned with details of bytecode generation (I can imagine that you want to have some `new` instruction in your method but you want to know that no constructor of anonfun is called)

Cons:
  - relies on bytecode instrumentation

I think in your specific case both ways will do. I wanted to point out at existing test for the optimizer, covering similar area.