EventFactory { public static InvestmentMadeEvent investmentMade(final Loan loan, final Money investedAmount, final PortfolioOverview portfolioOverview) { return new InvestmentMadeEventImpl(loan, investedAmount, portfolioOverview); } private  EventFactory(); static ExecutionCompletedEvent executionCompleted(final Collection<Loan> investments,
            final PortfolioOverview portfolioOverview); static ExecutionStartedEvent executionStarted(final PortfolioOverview portfolioOverview); static InvestmentMadeEvent investmentMade(final Loan loan, final Money investedAmount,
            final PortfolioOverview portfolioOverview); static InvestmentPurchasedEvent investmentPurchased(final Participation participation, final Loan loan,
            final Money purchasedAmount,
            final PortfolioOverview portfolioOverview); static InvestmentSoldEvent investmentSold(final Investment investment, final Loan loan,
            final PortfolioOverview portfolioOverview); static LoanDefaultedEvent loanDefaulted(final Investment investment, final Loan loan,
            final LocalDate since); static LoanNowDelinquentEvent loanNowDelinquent(final Investment investment, final Loan loan); static LoanDelinquent10DaysOrMoreEvent loanDelinquent10plus(final Investment investment, final Loan loan); static LoanDelinquent30DaysOrMoreEvent loanDelinquent30plus(final Investment investment, final Loan loan); static LoanDelinquent60DaysOrMoreEvent loanDelinquent60plus(final Investment investment, final Loan loan); static LoanDelinquent90DaysOrMoreEvent loanDelinquent90plus(final Investment investment, final Loan loan); static LoanLostEvent loanLost(final Investment investment, final Loan loan); static LoanNoLongerDelinquentEvent loanNoLongerDelinquent(final Investment investment, final Loan loan); static LoanRecommendedEvent loanRecommended(final RecommendedLoan recommendation); static PurchaseRecommendedEvent purchaseRecommended(final RecommendedParticipation recommendation); static PurchasingCompletedEvent purchasingCompleted(final Collection<Participation> investment,
            final PortfolioOverview portfolio); static PurchasingStartedEvent purchasingStarted(final PortfolioOverview portfolio); static RoboZonkyCrashedEvent roboZonkyCrashed(final Throwable cause); static RoboZonkyDaemonSuspendedEvent roboZonkyDaemonSuspended(final Exception cause); static RoboZonkyDaemonResumedEvent roboZonkyDaemonResumed(final OffsetDateTime since,
            final OffsetDateTime until); static RoboZonkyEndingEvent roboZonkyEnding(); static RoboZonkyExperimentalUpdateDetectedEvent roboZonkyExperimentalUpdateDetected(final String version); static RoboZonkyInitializedEvent roboZonkyInitialized(); static RoboZonkyStartingEvent roboZonkyStarting(); static RoboZonkyTestingEvent roboZonkyTesting(); static WeeklySummaryEvent weeklySummary(final ExtendedPortfolioOverview portfolioOverview); static RoboZonkyUpdateDetectedEvent roboZonkyUpdateDetected(final String version); static SaleOfferedEvent saleOffered(final Investment investment, final Loan loan); static SaleRecommendedEvent saleRecommended(final RecommendedInvestment recommendation); static SellingCompletedEvent sellingCompleted(final Collection<Investment> investments,
            final PortfolioOverview portfolio); static SellingStartedEvent sellingStarted(final PortfolioOverview portfolio); static ReservationCheckStartedEvent reservationCheckStarted(final PortfolioOverview portfolioOverview); static ReservationCheckCompletedEvent reservationCheckCompleted(final Collection<Reservation> investments,
            final PortfolioOverview portfolioOverview); static ReservationAcceptationRecommendedEvent reservationAcceptationRecommended(
            final RecommendedReservation recommendation); static ReservationAcceptedEvent reservationAccepted(final Loan loan, final Money investedAmount,
            final PortfolioOverview portfolioOverview); static LazyEvent<ReservationAcceptedEvent> reservationAcceptedLazy(
            final Supplier<ReservationAcceptedEvent> supplier); static LazyEvent<InvestmentMadeEvent> investmentMadeLazy(final Supplier<InvestmentMadeEvent> supplier); static LazyEvent<InvestmentPurchasedEvent> investmentPurchasedLazy(
            final Supplier<InvestmentPurchasedEvent> supplier); static LazyEvent<InvestmentSoldEvent> investmentSoldLazy(final Supplier<InvestmentSoldEvent> supplier); static LazyEvent<LoanDefaultedEvent> loanDefaultedLazy(final Supplier<LoanDefaultedEvent> supplier); static LazyEvent<LoanNowDelinquentEvent> loanNowDelinquentLazy(
            final Supplier<LoanNowDelinquentEvent> supplier); static LazyEvent<LoanDelinquent10DaysOrMoreEvent> loanDelinquent10plusLazy(
            final Supplier<LoanDelinquent10DaysOrMoreEvent> supplier); static LazyEvent<LoanDelinquent30DaysOrMoreEvent> loanDelinquent30plusLazy(
            final Supplier<LoanDelinquent30DaysOrMoreEvent> supplier); static LazyEvent<LoanDelinquent60DaysOrMoreEvent> loanDelinquent60plusLazy(
            final Supplier<LoanDelinquent60DaysOrMoreEvent> supplier); static LazyEvent<LoanDelinquent90DaysOrMoreEvent> loanDelinquent90plusLazy(
            final Supplier<LoanDelinquent90DaysOrMoreEvent> supplier); static LazyEvent<LoanLostEvent> loanLostLazy(final Supplier<LoanLostEvent> supplier); static LazyEvent<LoanNoLongerDelinquentEvent> loanNoLongerDelinquentLazy(
            final Supplier<LoanNoLongerDelinquentEvent> supplier); static LazyEvent<ExecutionCompletedEvent> executionCompletedLazy(
            final Supplier<ExecutionCompletedEvent> supplier); static LazyEvent<ExecutionStartedEvent> executionStartedLazy(
            final Supplier<ExecutionStartedEvent> supplier); static LazyEvent<PurchasingCompletedEvent> purchasingCompletedLazy(
            final Supplier<PurchasingCompletedEvent> supplier); static LazyEvent<PurchasingStartedEvent> purchasingStartedLazy(
            final Supplier<PurchasingStartedEvent> supplier); static LazyEvent<SellingCompletedEvent> sellingCompletedLazy(
            final Supplier<SellingCompletedEvent> supplier); static LazyEvent<T> async(final Class<T> clz, final Supplier<T> eventSupplier);  }
@Test void investmentMade() { final InvestmentMadeEvent e = EventFactory.investmentMade(MockLoanBuilder.fresh(), Money.from(200), mockPortfolioOverview()); assertSoftly(softly -> { softly.assertThat(e.getLoan()) .isNotNull(); softly.assertThat(e.getInvestedAmount()) .isEqualTo(Money.from(200)); softly.assertThat(e.getPortfolioOverview()) .isNotNull(); }); }