### Question:
Portfolio { protected final Map<Date, Double> getChartShareValueData() { Map<Date, Double> data = new HashMap<>(); List<ShareValue> shareValuess = getShareValues(); int max = shareValuess.size(); double base = shareValuess.get(max - 1).getShareValue(); for (int i = max - 1; i != -1; i--) { ShareValue temp = shareValuess.get(i); Double value = temp.getShareValue() * PERCENT / base; data.put(temp.getDate(), value); } chartShareValueData = new TreeMap<>(); chartShareValueData.putAll(data); return chartShareValueData; } Portfolio(); final Double getTotalValue(); final Double getTotalPlusMinusValue(); final Double getTotalPlusMinusValueAbsolute(); final Double getYieldYear(); final Double getTotalGain(); final Double getYieldYearPerc(); final Date getLastCompanyUpdate(); final void setLastCompanyUpdate(final Date lastCompanyUpdate); final void compute(); final Double getTotalGainTodayAbsolute(); final List<String> getCompaniesYahooIdRealTime(); final void addIndexes(final List<Index> indexes); final String getPortfolioReview(); final IChart getPieChartSector(); final IChart getPieChartCap(); final IChart getTimeValueChart(); final IChart getTimeChart(); final Optional<Account> getAccount(final String name); final Optional<Account> getAccount(final int id); final Optional<Account> getFirstAccount(); final String getHTMLSectorByCompanies(); final String getHTMLCapByCompanies(); final Double getMaxShareValue(); final Date getMaxShareValueDate(); final Double getCurrentShareValuesYield(); final Double getCurrentShareValuesTaxes(); final Double getCurrentShareValuesVolume(); final Double getCurrenShareValuesGain(); final Double getCurrenShareValuesGainPorcentage(); final JsonObject getJSONObject();  }### Answer:
@Test public void testGetChartShareValueData() { portfolio.setShareValues(createShareValues()); Map<Date, Double> actual = portfolio.getChartShareValueData(); assertNotNull(actual); assertThat(actual.size(), is(2)); Iterator<Date> iterator = actual.keySet().iterator(); assertEquals(100d, actual.get(iterator.next()), 0.1); assertEquals(50d, actual.get(iterator.next()), 0.1); }