title: Unit testing Spring @Around AOP methods
body: <p>I can unit test most of my Spring classes without needing to do Spring "stuff".</p>
  
  <p>I can unit test @Before advice methods without using Spring too:</p>
  
  <p>Example code:</p>
  
  <pre><code>@Before("execution(* run(..)) &amp;&amp; " + "" +
            "target(target) &amp;&amp; " +
          "args(name)")
  public void logName(Object target, String name) {
      logger.info("{} - run: {}", target, name);
  }
  </code></pre>
  
  <p>Example test:</p>
  
  <pre><code>@Test
  public void testLogName() {
      aspect.setLogger(mockLogger);
      aspect.logName(this,"Barry");
      assertTrue(mockLogger.hasLogged("TestAspect - run: Barry"));
  }
  </code></pre>
  
  <p>However @Around advice deals with a ProceedingJoinPoint object:</p>
  
  <pre><code>@Around("com.xyz.myapp.SystemArchitecture.businessService()")
  public Object doBasicProfiling(ProceedingJoinPoint pjp) throws Throwable {
     // start stopwatch
     Object retVal = pjp.proceed();
     // stop stopwatch
     return retVal;
   }
  </code></pre>
  
  <p>I don't know how to instantiate a ProceedingJoinPoint object. How do I test this class without starting a whole Spring application context?</p>