BusinessLocalTransactionAspect { @Around("localTransactionPointcut()") public void beginLocalTransaction(ProceedingJoinPoint pjp) throws Throwable { LocalTransactionStepDefinition pipeline = (LocalTransactionStepDefinition) pjp.proceed(); this.businessLocalTransactionManager.begin(pipeline); } BusinessLocalTransactionAspect(BusinessLocalTransactionManager businessTransactionManager); @Pointcut("@annotation(io.kermoss.trx.app.annotation.BusinessLocalTransactional)") void localTransactionPointcut(); @Pointcut("@annotation(io.kermoss.trx.app.annotation.SwitchBusinessLocalTransactional)") void moveLocalTransactionPointcut(); @Pointcut("@annotation(io.kermoss.trx.app.annotation.RollBackBusinessLocalTransactional)") void rollBackLocalTransactionPointcut(); @Around("localTransactionPointcut()") void beginLocalTransaction(ProceedingJoinPoint pjp); @Around("moveLocalTransactionPointcut()") void moveLocalTransaction(ProceedingJoinPoint pjp); @Around("rollBackLocalTransactionPointcut()") void rollBackTransaction(ProceedingJoinPoint pjp);  }
@Test public void testBeginLocalTransaction() throws Throwable { final ProceedingJoinPoint pjp = mock(ProceedingJoinPoint.class); final LocalTransactionStepDefinition localTransactionStepDefinition = mock(LocalTransactionStepDefinition.class); when(pjp.proceed()).thenReturn(localTransactionStepDefinition); businessLocalTransactionAspectUnderTest.beginLocalTransaction(pjp); verify(mockBusinessLocalTransactionManager, times(1)).begin(localTransactionStepDefinition); }