}
@Test
public void testCapitalGainsWithPartialSellDuringReportPeriodWithFees()
{
Client client = new Client();
Security security = new Security();
security.addPrice(new SecurityPrice(Dates.date(2010, Calendar.JANUARY, 1), 10000));
security.addPrice(new SecurityPrice(Dates.date(2011, Calendar.JUNE, 1), 11000));
client.addSecurity(security);
Portfolio portfolio = new Portfolio();
portfolio.addTransaction(new PortfolioTransaction(Dates.date(2010, Calendar.JANUARY, 1), security,
PortfolioTransaction.Type.BUY, 1000000, 100, 0, 0));
portfolio.addTransaction(new PortfolioTransaction(Dates.date(2011, Calendar.JANUARY, 15), security,
PortfolioTransaction.Type.SELL, 100000, 9900, 1, 0));
client.addPortfolio(portfolio);
ClientPerformanceSnapshot snapshot = new ClientPerformanceSnapshot(client, startDate, endDate);
EnumMap<CategoryType, Category> result = snapshot.getCategoryMap();
assertEquals(1000 * 9 + (9900 - 10000) + 1, result.get(CategoryType.CAPITAL_GAINS).getValuation());