TransactionalPowerTenantImpl implements TransactionalPowerTenant { @Override public Optional<PurchaseStrategy> getPurchaseStrategy() { return parent.getPurchaseStrategy(); } TransactionalPowerTenantImpl(final PowerTenant parent); @Override void setKnownBalanceUpperBound(final Money knownBalanceUpperBound); @Override Money getKnownBalanceUpperBound(); @Override CompletableFuture<?> fire(final SessionEvent event); @Override CompletableFuture<?> fire(final LazyEvent<? extends SessionEvent> event); @Override void commit(); @Override void abort(); @Override T call(final Function<Zonky, T> operation); @Override Availability getAvailability(); @Override RemotePortfolio getPortfolio(); @Override SessionInfo getSessionInfo(); @Override Optional<InvestmentStrategy> getInvestmentStrategy(); @Override Optional<SellStrategy> getSellStrategy(); @Override Optional<PurchaseStrategy> getPurchaseStrategy(); @Override Optional<ReservationStrategy> getReservationStrategy(); @Override Loan getLoan(final int loanId); @Override Investment getInvestment(final long investmentId); @Override Investment getInvestment(long investmentId, boolean fresh); @Override InstanceState<T> getState(final Class<T> clz); @Override void close(); @Override String toString();  }
@Test void delegatesPurchaseStrategy() { when(tenant.getPurchaseStrategy()).thenReturn(Optional.of(mock(PurchaseStrategy.class))); final Optional<PurchaseStrategy> result = tenant.getPurchaseStrategy(); assertThat(transactional.getPurchaseStrategy()).isEqualTo(result); }