@Ignore("Need to figure out how to mock brave spans") @Test public void doGetPortfolio() { when(repo.findByUserId(ServiceTestConfiguration.USER_ID)).thenReturn(ServiceTestConfiguration.orders()); when(quoteService.getQuote(ServiceTestConfiguration.quote().getSymbol())).thenReturn(ServiceTestConfiguration.quote()); when(tracer.nextSpan()).thenReturn(clientTracing.tracer().newTrace()); when(tracer.nextSpan().name(any(String.class))).thenReturn(clientTracing.tracer().newTrace()); when(portfolioRepositoryService.getOrders(ServiceTestConfiguration.USER_ID)).thenReturn(new ArrayList<>()); Portfolio folio = service.getPortfolio(ServiceTestConfiguration.USER_ID); }
public Portfolio getPortfolio(String userId) { logger.debug("Getting portfolio for accountId: " + userId); List<Order> orders = portfolioRepositoryService.getOrders(userId); Portfolio folio = new Portfolio(); folio.setUserName(userId); return createPortfolio(folio, orders); }
PortfolioService { public Portfolio getPortfolio(String userId) { logger.debug("Getting portfolio for accountId: " + userId); List<Order> orders = portfolioRepositoryService.getOrders(userId); Portfolio folio = new Portfolio(); folio.setUserName(userId); return createPortfolio(folio, orders); } }
PortfolioService { public Portfolio getPortfolio(String userId) { logger.debug("Getting portfolio for accountId: " + userId); List<Order> orders = portfolioRepositoryService.getOrders(userId); Portfolio folio = new Portfolio(); folio.setUserName(userId); return createPortfolio(folio, orders); }  }
PortfolioService { public Portfolio getPortfolio(String userId) { logger.debug("Getting portfolio for accountId: " + userId); List<Order> orders = portfolioRepositoryService.getOrders(userId); Portfolio folio = new Portfolio(); folio.setUserName(userId); return createPortfolio(folio, orders); }  Portfolio getPortfolio(String userId); @Transactional Order addOrder(Order order); }
PortfolioService { public Portfolio getPortfolio(String userId) { logger.debug("Getting portfolio for accountId: " + userId); List<Order> orders = portfolioRepositoryService.getOrders(userId); Portfolio folio = new Portfolio(); folio.setUserName(userId); return createPortfolio(folio, orders); }  Portfolio getPortfolio(String userId); @Transactional Order addOrder(Order order);  }