PortfolioOverviewImpl implements PortfolioOverview { @Override public Money getInvested() { return this.invested; } PortfolioOverviewImpl(final RemotePortfolioImpl impl);   PortfolioOverviewImpl(final Map<Rating, Money> investedPerRating, final Ratio profitability); @Override Money getInvested(); @Override Money getInvested(final Rating r); @Override Ratio getAnnualProfitability(); @Override ZonedDateTime getTimestamp(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test void emptyPortfolio() { final PortfolioOverview po = new PortfolioOverviewImpl(Collections.emptyMap(), Ratio.ZERO); assertSoftly(softly -> { softly.assertThat(po.getInvested()) .isEqualTo(Money.ZERO); for (final Rating r : Rating.values()) { softly.assertThat(po.getInvested(r)) .as(r + " invested") .isEqualTo(Money.ZERO); softly.assertThat(po.getShareOnInvestment(r)) .as(r + " as a share") .isEqualTo(Ratio.ZERO); } }); }
@Test void emptyPortfolioWithAdjustmentsAndRisks() { final Money adj = Money.from(10); final Map<Rating, Money> in = Collections.singletonMap(Rating.D, adj); final PortfolioOverview po = new PortfolioOverviewImpl(in, Ratio.ZERO); assertSoftly(softly -> { softly.assertThat(po.getInvested()) .isEqualTo(adj); for (final Rating r : Rating.values()) { final Money expectedAbsolute = r == Rating.D ? adj : Money.ZERO; final Money expectedRelative = r == Rating.D ? Money.from(1) : Money.ZERO; softly.assertThat(po.getInvested(r)) .as(r + " invested") .isEqualTo(expectedAbsolute); softly.assertThat(po.getShareOnInvestment(r)) .as(r + " as a share") .isEqualTo(Ratio.fromRaw(expectedRelative.getValue())); } }); }