DefaultValues { public void setTargetPortfolioSize(final long targetPortfolioSize) { if (targetPortfolioSize <= 0) { throw new IllegalArgumentException("Target portfolio size must be a positive number."); } this.targetPortfolioSize = Money.from(targetPortfolioSize); } DefaultValues(final DefaultPortfolio portfolio); DefaultPortfolio getPortfolio(); Optional<ReservationMode> getReservationMode(); void setReservationMode(final ReservationMode reservationMode); Optional<SellingMode> getSellingMode(); void setSellingMode(final SellingMode sellingMode); void setExitProperties(final ExitProperties properties); boolean isSelloffStarted(); long getMonthsBeforeExit(); Money getTargetPortfolioSize(); void setTargetPortfolioSize(final long targetPortfolioSize); DefaultInvestmentShare getInvestmentShare(); void setInvestmentShare(final DefaultInvestmentShare investmentShare); MoneyRange getInvestmentSize(); void setInvestmentSize(final int investmentSize); MoneyRange getPurchaseSize(); void setPurchaseSize(final int purchaseSize); @Override String toString();  }
@Test void setTargetPortfolioSize() { final DefaultPortfolio p = DefaultPortfolio.PROGRESSIVE; final DefaultValues sut = new DefaultValues(p); assertThat(sut.getTargetPortfolioSize()).isEqualTo(Money.from(Long.MAX_VALUE)); sut.setTargetPortfolioSize(400); assertThat(sut.getTargetPortfolioSize()).isEqualTo(Money.from(400)); }
@Test void setWrongTargetPortfolioSize() { final DefaultPortfolio p = DefaultPortfolio.EMPTY; final DefaultValues sut = new DefaultValues(p); assertThatThrownBy(() -> sut.setTargetPortfolioSize(0)).isInstanceOf(IllegalArgumentException.class); }