### Question:
DayImpression implements Serializable { public long countImpressions(double price, TargetingChannel.PriceModel priceModel) { long result = 0; if (price == BookingService.HIGH_PRICE) { for (Impression h : hours) { result += h.getTotal(); } } else { int priceCategory = CommonUtil.determinePriceCat(price, priceModel); for (Impression h : hours) { long t = h.getCountByPriceCategory(priceCategory); result += t; } } LOGGER.debug("impressions={}", result); return result; } DayImpression(String date, List<Impression> hours);  DayImpression();  DayImpression(Double[] dayCounts);  DayImpression(Object hoursMap); String getDate(); void setDate(String date); List<Impression> getHours(); void setHours(List<Impression> hours); void initAggregate(double[] aggregatedHCounts); long countImpressions(double price, TargetingChannel.PriceModel priceModel); static DayImpression add(DayImpression d1, DayImpression d2); static DayImpression buildEmptyDayImpression(String date); static DayImpression subtract(DayImpression d1, DayImpression d2); static DayImpression multiply(DayImpression d1, double r); @Override String toString();  }### Answer:
@Test public void countImpressions() { Double[] dayCnt = new Double[]{24.1, 25.2, 26.3, 27.4}; DayImpression di = new DayImpression(dayCnt); double price = 100D; TargetingChannel tc = new TargetingChannel(); tc.setPm("CPC"); long res = di.countImpressions(price, tc.getPm()); assertNotNull(res); assertEquals(96, res, Double.MAX_VALUE); price = Long.MAX_VALUE; res = di.countImpressions(price, tc.getPm()); assertNotNull(res); assertEquals(96, res, Double.MAX_VALUE); }