BusinessGlobalTransactionServiceImpl implements BusinessGlobalTransactionService { @Override public Optional<GlobalTransaction> retrieveGlobalTransaction(Optional<RequestGlobalTransaction> orgt) { Optional<GlobalTransaction> globalTransaction = Optional.empty(); if(orgt.isPresent()){ RequestGlobalTransaction rgt = orgt.get(); String id = rgt.getGTX(); String parentId = rgt.getParent(); if (id == null && parentId != null) { globalTransaction = globalTransactionRepository.findByNameAndParent(rgt.getName(), parentId); } else { globalTransaction =this.findGlobalTransaction(id); } } return globalTransaction; } BusinessGlobalTransactionServiceImpl(); @Autowired  BusinessGlobalTransactionServiceImpl(GlobalTransactionRepository globalTransactionRepository,
												Tracer tracer,
												ApplicationEventPublisher publisher); @Override Optional<GlobalTransaction> findGlobalTransaction(final String id); @Override GlobalTransaction participateToGlobalTransaction(Optional<RequestGlobalTransaction> orgt); @Override Optional<GlobalTransaction> retrieveGlobalTransaction(Optional<RequestGlobalTransaction> orgt);  }
@Test public void testRetrieveGlobalTransactionRequestGlobalTransactionNotPresent() { final Optional<RequestGlobalTransaction> orgt = Optional.empty(); final Optional<GlobalTransaction> result = businessGlobalTransactionServiceImplUnderTest.retrieveGlobalTransaction(orgt); assertEquals(Optional.empty(), result); }