### Question:
Booking { public static Map<String, Booking> buildBookingMap(List<Booking> bookings) { Map<String, Booking> bookingMap = new HashMap<>(); if (bookings != null) { for (Booking booking : bookings) { bookingMap.put(booking.getBookingId(), booking); } } return bookingMap; } Booking(TargetingChannel targetingChannel, List<Range> ranges, double price, String advId, long requestCount);  Booking(String id, Map source); static Number extractNumber(Object obj); static Map<String, Booking> buildBookingMap(List<Booking> bookings); static List<String> extractBookingIds(List<Booking> bookings); String getId(); List<String> getDays(); String getBookingId(); String getAdvId(); Double getPrice(); Long getAmount(); TargetingChannel getQuery();  }### Answer:
@Test public void buildBookingMap() { List<Range> ranges = new ArrayList<>(); Range r1 = new Range("2018-01-05", "2018-01-05", "0", "23"); ranges.add(r1); Booking bk1 = new Booking(new TargetingChannel(), ranges, 0, "", 0); List<Booking> bks1 = new ArrayList<>(); bks1.add(bk1); assertEquals(1, Booking.buildBookingMap(bks1).size(), 0); TargetingChannel tc2_1 = new TargetingChannel(); tc2_1.setG(Arrays.asList("g_m")); Booking bk2_1 = new Booking(tc2_1, ranges, 0, "advid2001", 0); List<Booking> bks2_1 = new ArrayList<>(); bks2_1.add(bk1); bks2_1.add(bk2_1); assertEquals(2, Booking.buildBookingMap(bks2_1).size(), 0); TargetingChannel tc2_2 = new TargetingChannel(); tc2_2.setA(Arrays.asList("3")); Booking bk2_2 = new Booking(tc2_2, ranges, 0, "advid2002", 0); List<Booking> bks2_2 = new ArrayList<>(); bks2_1.add(bk2_2); assertEquals(0, Booking.buildBookingMap(bks2_2).size(), 0); TargetingChannel tc3 = new TargetingChannel(); tc3.setG(Arrays.asList("g_m")); tc3.setA(Arrays.asList("3")); Booking bk3 = new Booking(tc3, ranges, 0, "advid300", 0); List<Booking> bks3 = new ArrayList<>(); bks3.add(bk3); assertEquals(1, Booking.buildBookingMap(bks3).size(), 0); }