Util { static boolean isAcceptable(final ParsedStrategy strategy, final PortfolioOverview portfolio) { final Money invested = portfolio.getInvested(); final Money investmentCeiling = strategy.getMaximumInvestmentSize(); if (invested.compareTo(investmentCeiling) >= 0) { LOGGER.debug("Not recommending any loans due to reaching the ceiling."); return false; } return true; } private  Util();   }
@Test void acceptable() { final ParsedStrategy s = mock(ParsedStrategy.class); when(s.getMaximumInvestmentSize()).thenReturn(Money.from(1_000)); final PortfolioOverview p = mockPortfolioOverview(); when(p.getInvested()).thenReturn(Money.from(999)); assertThat(Util.isAcceptable(s, p)).isTrue(); }
@Test void unacceptableDueToCeiling() { final ParsedStrategy s = mock(ParsedStrategy.class); when(s.getMaximumInvestmentSize()).thenReturn(Money.from(10_000)); final PortfolioOverview p = mockPortfolioOverview(); when(p.getInvested()).thenReturn(Money.from(10_000)); assertThat(Util.isAcceptable(s, p)).isFalse(); }