Search in sources :

Example 6 with RecommendedParticipation

use of com.github.robozonky.api.strategies.RecommendedParticipation in project robozonky by RoboZonky.

the class NaturalLanguagePurchaseStrategyTest method unacceptablePortfolioDueToOverInvestment.

@Test
void unacceptablePortfolioDueToOverInvestment() {
    final DefaultValues v = new DefaultValues(DefaultPortfolio.EMPTY);
    v.setTargetPortfolioSize(1000);
    final ParsedStrategy p = new ParsedStrategy(v);
    final PurchaseStrategy s = new NaturalLanguagePurchaseStrategy(p);
    final PortfolioOverview portfolio = mock(PortfolioOverview.class);
    when(portfolio.getCzkAvailable()).thenReturn(p.getMinimumBalance());
    when(portfolio.getCzkInvested()).thenReturn(p.getMaximumInvestmentSizeInCzk());
    final Stream<RecommendedParticipation> result = s.recommend(Collections.singletonList(mockDescriptor()), portfolio, new Restrictions());
    assertThat(result).isEmpty();
}
Also used : PurchaseStrategy(com.github.robozonky.api.strategies.PurchaseStrategy) Restrictions(com.github.robozonky.api.remote.entities.Restrictions) PortfolioOverview(com.github.robozonky.api.strategies.PortfolioOverview) RecommendedParticipation(com.github.robozonky.api.strategies.RecommendedParticipation) Test(org.junit.jupiter.api.Test)

Aggregations

RecommendedParticipation (com.github.robozonky.api.strategies.RecommendedParticipation)6 Restrictions (com.github.robozonky.api.remote.entities.Restrictions)5 PortfolioOverview (com.github.robozonky.api.strategies.PortfolioOverview)5 PurchaseStrategy (com.github.robozonky.api.strategies.PurchaseStrategy)5 Test (org.junit.jupiter.api.Test)5 Participation (com.github.robozonky.api.remote.entities.Participation)3 InvestmentPurchasedEvent (com.github.robozonky.api.notifications.InvestmentPurchasedEvent)1 PurchaseRequestedEvent (com.github.robozonky.api.notifications.PurchaseRequestedEvent)1 Investment (com.github.robozonky.api.remote.entities.sanitized.Investment)1 Loan (com.github.robozonky.api.remote.entities.sanitized.Loan)1 ParticipationDescriptor (com.github.robozonky.api.strategies.ParticipationDescriptor)1 MarketplaceFilter (com.github.robozonky.strategy.natural.conditions.MarketplaceFilter)1