### Question:
BookingBucket implements Comparable { @JsonIgnore public double getSumOfAllocatedAmounts() { double result = 0; for (Number d : this.getAllocatedAmounts().values()) { result += d.doubleValue(); } return result; } BookingBucket();  BookingBucket(String day, String bookingId, List<String> previousBookingOrder, int priority);  BookingBucket(String id, Map source); static BookingBucket clone(BookingBucket bb); String getId(); String getDay(); Integer getPriority(); Map<String, Double> getAllocatedAmounts(); @JsonIgnore double getSumOfAllocatedAmounts(); @Override int compareTo(Object o); Map<String, List<Double>> getAvgTbrMap(); void setAvgTbrMap(Map<String, List<Double>> avgTbrMap); List<String> getAndBookingsIds(); List<String> getMinusBookingsIds(); AvrTBRInsight getAvrTBRInsight(Set<String> validBookingIds);  }### Answer:
@Test public void getSumOfAllocatedAmounts() { String day = "20180105", bookingId = "test_bkid_1"; List<String> prvBkOrder = new ArrayList(); BookingBucket bb1 = new BookingBucket(day, bookingId, prvBkOrder, 1); assertEquals(0D, bb1.getSumOfAllocatedAmounts(), 0); Map source = new HashMap(), alloc = new HashMap(); alloc.put("alloc1", 1D); alloc.put("alloc2", 0.6999); source.put("day", day); source.put("minus_bk_ids", Arrays.asList("mnBkIds")); source.put("and_bk_ids", Arrays.asList("ndBkIds")); source.put("allocated_amount", alloc); source.put("priority", 2); String id2 = "test_MockID"; BookingBucket bb2 = new BookingBucket(id2, source); assertEquals(1.6999, bb2.getSumOfAllocatedAmounts(), 0.1D); }