Unit test cases for the spring aspect by traversing the join point?

i has a spring aop aspect, and it has a method as shown below: this is the aspect that will be called before a particular method.

public void someMethod(JoinPoint jp) {
        //Somelogic
    }

I need to write a junit test case. How can I create an instance and send parameters to someMethod? I mean, how can I fill in the JoinPointarguments? how to set parameters at the connection point and pass it? The aspect is configured in the application context xml file.

Thank!

+5
source share
2 answers

I think you have a couple of good options here ...

  • JoinPoint - . - "", , . someMethod.
  • , JoinPoint . , , Mockito, .

, ( , ) , / - ( ), , unit test , JoinPoint, Spring/AspectJ, unit test. , - .

+5

, - " ", , ​​ , .

JoinPoint, , , , , , .

0

All Articles