@Test
void eliminatesUselessLoans() {

    final Loan alreadyInvested = new MockLoanBuilder()
        .set(LoanImpl::setRating, Rating.B)
        .set(LoanImpl::setRemainingInvestment, Money.from(1))
        .set(LoanImpl::setReservedAmount, Money.from(0))
        .set(LoanImpl::setMyInvestment, mockMyInvestment())
        .build();
    final Loan normal = new MockLoanBuilder()
        .set(LoanImpl::setRating, Rating.A)
        .set(LoanImpl::setRemainingInvestment, Money.from(1))
        .set(LoanImpl::setReservedAmount, Money.from(0))
        .build();
    final Zonky zonky = harmlessZonky();
    when(zonky.getAvailableLoans(any())).thenReturn(Stream.of(alreadyInvested, normal));
    final Tenant tenant = mockTenant(zonky);
    final AbstractMarketplaceAccessor<LoanDescriptor> d = new PrimaryMarketplaceAccessor(tenant,
            UnaryOperator.identity());
    final Collection<LoanDescriptor> ld = d.getMarketplace();
    assertThat(ld).hasSize(1)
        .element(0)
        .extracting(LoanDescriptor::item)
        .isSameAs(normal);
}