### Question:
BagUtils { public static <E> Bag<E> transformingBag(final Bag<E> bag, final Transformer<? super E, ? extends E> transformer) { return TransformedBag.transformingBag(bag, transformer); } private  BagUtils(); static Bag<E> synchronizedBag(final Bag<E> bag); static Bag<E> unmodifiableBag(final Bag<? extends E> bag); static Bag<E> predicatedBag(final Bag<E> bag, final Predicate<? super E> predicate); static Bag<E> transformingBag(final Bag<E> bag, final Transformer<? super E, ? extends E> transformer); static Bag<E> collectionBag(final Bag<E> bag); static SortedBag<E> synchronizedSortedBag(final SortedBag<E> bag); static SortedBag<E> unmodifiableSortedBag(final SortedBag<E> bag); static SortedBag<E> predicatedSortedBag(final SortedBag<E> bag,
            final Predicate<? super E> predicate); static SortedBag<E> transformingSortedBag(final SortedBag<E> bag,
                                                         final Transformer<? super E, ? extends E> transformer); @SuppressWarnings("unchecked") // OK, empty bag is compatible with any type static Bag<E> emptyBag(); @SuppressWarnings("unchecked") // OK, empty bag is compatible with any type static SortedBag<E> emptySortedBag(); @SuppressWarnings("rawtypes") // OK, empty bag is compatible with any type
    static final Bag EMPTY_BAG; @SuppressWarnings("rawtypes") // OK, empty bag is compatible with any type
    static final Bag EMPTY_SORTED_BAG; }### Answer:
@Test public void testTransformedBag() { Bag<Object> bag = BagUtils.transformingBag(new HashBag<Object>(), nopTransformer); assertTrue("Returned object should be an TransformedBag.", bag instanceof TransformedBag); try { BagUtils.transformingBag(null, nopTransformer); fail("Expecting NullPointerException for null bag."); } catch (final NullPointerException ex) { } try { BagUtils.transformingBag(new HashBag<Object>(), null); fail("Expecting NullPointerException for null transformer."); } catch (final NullPointerException ex) { } }