@Test
void profitability() {

    final Map<Rating, Money> investments = new EnumMap<>(Rating.class);
    investments.put(Rating.AAAAA, Money.from(200_000));
    investments.put(Rating.D, Money.from(20_000));
    final PortfolioOverview po = new PortfolioOverviewImpl(investments, Ratio.fromPercentage(4));
    assertSoftly(softly -> {
        // the values tested against have been calculated manually and are guaranteed correct
        softly.assertThat(po.getAnnualProfitability())
            .isEqualTo(Ratio.fromPercentage(4));
        softly.assertThat(po.getMinimalAnnualProfitability()
            .asPercentage()
            .doubleValue())
            .isCloseTo(3.72, within(0.01));
        softly.assertThat(po.getOptimalAnnualProfitability()
            .asPercentage()
            .doubleValue())
            .isCloseTo(4.87, within(0.01));
        softly.assertThat(po.getMonthlyProfit()
            .getValue()
            .intValue())
            .isCloseTo(733, within(1));
        softly.assertThat(po.getMinimalMonthlyProfit()
            .getValue()
            .intValue())
            .isCloseTo(682, within(1));
        softly.assertThat(po.getOptimalMonthlyProfit()
            .getValue()
            .intValue())
            .isCloseTo(893, within(1));
    });
}