BusinessGlobalTransactionAspect { @Around("commitLocalTransactionPointcut()") public void moveLocalTransaction(ProceedingJoinPoint pjp) throws Throwable { GlobalTransactionStepDefinition pipeline = (GlobalTransactionStepDefinition) pjp.proceed(); this.businessTransactionManager.commit(pipeline); } BusinessGlobalTransactionAspect(BusinessGlobalTransactionManager businessTransactionManager, ApplicationEventPublisher applicationEventPublisher); @Pointcut("@annotation(io.kermoss.trx.app.annotation.BusinessGlobalTransactional)") void globalTransactionPointcut(); @Pointcut("@annotation(io.kermoss.trx.app.annotation.CommitBusinessGlobalTransactional)") void commitLocalTransactionPointcut(); @Around("globalTransactionPointcut()") void beginLocalTransaction(ProceedingJoinPoint pjp); @Around("commitLocalTransactionPointcut()") void moveLocalTransaction(ProceedingJoinPoint pjp);  }
@Test public void testMoveLocalTransaction() throws Throwable { final ProceedingJoinPoint pjp = mock(ProceedingJoinPoint.class); final GlobalTransactionStepDefinition globalTransactionStepDefinition = mock(GlobalTransactionStepDefinition.class); when(pjp.proceed()).thenReturn(globalTransactionStepDefinition); businessGlobalTransactionAspectUnderTest.moveLocalTransaction(pjp); verify(mockBusinessTransactionManager, times(1)).commit(globalTransactionStepDefinition); }