Summarizer implements TenantPayload { @Override public void accept(final Tenant tenant) { PowerTenant powerTenant = (PowerTenant) tenant; SessionEvents sessionEvents = Events.forSession(powerTenant); boolean shouldTrigger = force || sessionEvents.isListenerRegistered(WeeklySummaryEvent.class); if (!shouldTrigger) { LOGGER.debug("Skipping on account of no event listener being configured to receive the results."); return; } run(powerTenant); } Summarizer();   Summarizer(final boolean force); @Override void accept(final Tenant tenant);  }
@Test void basics() { final Summarizer summarizer = new Summarizer(true); summarizer.accept(tenant); assertThat(this.getEventsRequested()) .first() .isInstanceOf(WeeklySummaryEvent.class); final WeeklySummaryEvent evt = (WeeklySummaryEvent) this.getEventsRequested() .get(0); final ExtendedPortfolioOverview summary = evt.getPortfolioOverview(); assertThat(summary).isNotNull(); }