### Question:
MaxProfit { public int maxProfit2(int[] prices) { int winMoney = 0; for (int i = 0; i < prices.length - 1; i++) { if (prices[i + 1] > prices[i]) { winMoney += prices[i + 1] - prices[i]; } } return winMoney; }  int maxProfit(int[] prices); int maxProfit2(int[] prices);  }### Answer:
@Test void go2(){ MaxProfit maxProfit = new MaxProfit(); for (int i = 0; i < cases.size(); i++) { assertEquals((int) results.get(i),maxProfit.maxProfit2(cases.get(i))); } }