### Question:
Bag extends AbstractCollection<T> implements Serializable { public int count(T item) { Validate.notNull(item, "item must not be null"); Integer count = map.get(item); return count == null ? 0 : count; } Bag();  Bag(Map<? extends T, ? extends Integer> map); private  Bag(Map<T, Integer> map, int size);  Bag(Iterable<? extends T> iterable); @Deprecated static Bag<T> create(); @Deprecated static Bag<T> create(Iterable<? extends T> iterable); @Deprecated static Bag<T> create(Map<? extends T, ? extends Integer> map); @Override boolean add(T item); @Override Iterator<T> iterator(); @Override int size(); int add(T item, int increment); int removeAll(T item); int set(T item, int count); int count(T item); Set<Entry<T, Integer>> unique(); Set<T> uniqueItems(); Entry<T, Integer> getMax(); Entry<T, Integer> getMin(); Bag<T> createSorted(Order order); Map<T, Integer> toMap(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }### Answer:
@Test public void testCount() { assertEquals(3, bag1.count(ELEMENT1)); assertEquals(5, bag1.count(ELEMENT2)); assertEquals(2, bag1.count(ELEMENT3)); assertEquals(0, bag1.count(ELEMENT4)); }
@Test public void testBagAdd() { bag2.addAll(bag1); assertEquals(8, bag2.count(ELEMENT1)); assertEquals(8, bag2.count(ELEMENT2)); assertEquals(3, bag2.count(ELEMENT3)); assertEquals(7, bag2.count(ELEMENT4)); }