@Test
void properReal() {

    final Loan l = new MockLoanBuilder()
        .set(LoanImpl::setAmount, Money.from(200))
        .set(LoanImpl::setRating, Rating.D)
        .set(LoanImpl::setRemainingInvestment, Money.from(200))
        .set(LoanImpl::setReservedAmount, Money.from(0))
        .set(LoanImpl::setMyInvestment, mockMyInvestment())
        .build();
    final int loanId = l.getId();
    final Participation p = mock(ParticipationImpl.class);
    doReturn(l.getId()).when(p)
        .getLoanId();
    when(p.getRating()).thenReturn(Rating.D);
    when(p.getRemainingPrincipal()).thenReturn(Money.from(200));
    final PurchaseStrategy s = mock(PurchaseStrategy.class);
    when(s.recommend(any(), any(), any())).thenAnswer(i -> {
        final Collection<ParticipationDescriptor> participations = i.getArgument(0);
        return participations.stream()
            .map(ParticipationDescriptor::recommend)
            .flatMap(Optional::stream);
    });
    final Zonky z = harmlessZonky();
    when(z.getLoan(eq(loanId))).thenReturn(l);
    final PowerTenant auth = mockTenant(z, false);
    final ParticipationDescriptor pd = new ParticipationDescriptor(p, () -> l);
    final Collection<Participation> i = PurchasingSession.purchase(auth, Collections.singleton(pd), s);
    assertThat(i).hasSize(1);
    assertThat(getEventsRequested()).hasSize(4);
    verify(z).purchase(eq(p));
    final RemotePortfolio rp = auth.getPortfolio();
    final Rating rating = l.getRating();
    verify(rp).simulateCharge(eq(loanId), eq(rating), any());
    verify(auth).setKnownBalanceUpperBound(eq(Money.from(Integer.MAX_VALUE - 200)));
}