@Override
  @Test
  public void toSortedBag() {
    ImmutableBag<String> immutableBag = this.newBag();
    MutableSortedBag<String> sortedBag = immutableBag.toSortedBag();

    Verify.assertSortedBagsEqual(TreeBag.newBag(), sortedBag);

    MutableSortedBag<String> reverse = immutableBag.toSortedBag(Comparator.<String>reverseOrder());
    Verify.assertSortedBagsEqual(TreeBag.newBag(Comparator.<String>reverseOrder()), reverse);

    ImmutableBag<String> immutableBag1 = this.newBag();
    MutableSortedBag<String> sortedBag1 = immutableBag1.toSortedBag(Comparator.reverseOrder());
    Verify.assertSortedBagsEqual(TreeBag.newBag(), sortedBag1.toSortedBag());

    ImmutableBag<String> immutableBag2 = this.newBag();
    MutableSortedBag<String> sortedBag2 = immutableBag2.toSortedBag(Comparator.reverseOrder());
    Verify.assertSortedBagsEqual(TreeBag.newBag(Comparator.<String>reverseOrder()), sortedBag2);
  }
  @Test
  public void toSortedBag_empty() {
    ImmutableBag<String> immutableBag = Bags.immutable.of();

    MutableSortedBag<String> sortedBag =
        immutableBag.toSortedBag(Comparators.reverseNaturalOrder());
    sortedBag.addOccurrences("apple", 3);
    sortedBag.addOccurrences("orange", 2);

    Verify.assertSortedBagsEqual(
        TreeBag.newBagWith(
            Comparators.reverseNaturalOrder(), "orange", "orange", "apple", "apple", "apple"),
        sortedBag);
  }