Package com.google.common.collect.testing

Examples of com.google.common.collect.testing.TestStringSetGenerator


          CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
          CollectionSize.ANY)
      .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(
        new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            PopulatableMapAsMultimap<Integer, String> multimap
                = PopulatableMapAsMultimap.create();
            populateMultimapForGet(multimap, elements);
            return multimap.build().get(3);
          }
        })
        .named("Multimaps.forMap.get")
        .withFeatures(FOR_MAP_FEATURES_ONE)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(
        new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            PopulatableMapAsMultimap<String, Integer> multimap
                = PopulatableMapAsMultimap.create();
            populateMultimapForKeySet(multimap, elements);
            return multimap.build().keySet();
View Full Code Here


            CollectionFeature.SERIALIZABLE,
            CollectionFeature.ALLOWS_NULL_VALUES,
            MultisetFeature.ENTRIES_ARE_VIEWS)
        .named("TreeMultiset, NullsBeforeB")
        .createTestSuite());
    suite.addTest(NavigableSetTestSuiteBuilder.using(new TestStringSetGenerator() {
        @Override
        protected Set<String> create(String[] elements) {
          return TreeMultiset.create(Arrays.asList(elements)).elementSet();
        }
View Full Code Here

  public static Test suite() {
    TestSuite suite = new TestSuite();
   
    suite.addTestSuite(ForwardingNavigableSetTest.class);
    suite.addTest(
        SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            return new StandardImplForwardingNavigableSet<String>(
                new SafeTreeSet<String>(Arrays.asList(elements)));
          }

          @Override public List<String> order(List<String> insertionOrder) {
            return Lists.newArrayList(Sets.newTreeSet(insertionOrder));
          }
        }).named(
            "ForwardingNavigableSet[SafeTreeSet] with standard implementations")
            .withFeatures(CollectionSize.ANY, CollectionFeature.KNOWN_ORDER,
                CollectionFeature.GENERAL_PURPOSE).createTestSuite());
    suite.addTest(
        SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            SafeTreeSet<String> set = new SafeTreeSet<String>(Ordering.natural().nullsFirst());
            Collections.addAll(set, elements);
            return new StandardImplForwardingNavigableSet<String>(set);
          }
View Full Code Here

        }).named("ForwardingMultiset[ImmutableMultiset] with standard "
            + "implementations")
            .withFeatures(CollectionSize.ANY,
                CollectionFeature.ALLOWS_NULL_QUERIES)
            .createTestSuite());
    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {

      /**
       * Returns a Multiset that throws an exception on any attempt to use a
       * method not specifically authorized by the elementSet() or hashCode()
       * docs.
 
View Full Code Here

    suite.addTestSuite(UnmodifiableTreeColumnMapTests.class);

    // Not testing rowKeySet() or columnKeySet() of Table.transformValues()
    // since the transformation doesn't affect the row and column key sets.

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<String, Integer, Character> table
                = ArrayTable.create(
                    ImmutableList.copyOf(elements), ImmutableList.of(1, 2));
            populateForRowKeySet(table, elements);
            return table.rowKeySet();
          }
        })
        .named("ArrayTable.rowKeySet")
        .withFeatures(CollectionSize.ONE, CollectionSize.SEVERAL,
            CollectionFeature.KNOWN_ORDER,
            CollectionFeature.REJECTS_DUPLICATES_AT_CREATION,
            CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<String, Integer, Character> table = HashBasedTable.create();
            populateForRowKeySet(table, elements);
            return table.rowKeySet();
          }
        })
        .named("HashBasedTable.rowKeySet")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
        .withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .createTestSuite());

    suite.addTest(SortedSetTestSuiteBuilder.using(new TestStringSortedSetGenerator() {
          @Override protected SortedSet<String> create(String[] elements) {
            TreeBasedTable<String, Integer, Character> table = TreeBasedTable.create();
            populateForRowKeySet(table, elements);
            return table.rowKeySet();
          }

          @Override public List<String> order(List<String> insertionOrder) {
            Collections.sort(insertionOrder);
            return insertionOrder;
          }
        })
        .named("TreeBasedTable.rowKeySet")
        .withFeatures(COLLECTION_FEATURES_REMOVE_ORDER)
        .withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<String, Integer, Character> table = HashBasedTable.create();
            populateForRowKeySet(table, elements);
            return Tables.unmodifiableTable(table).rowKeySet();
          }
        })
        .named("unmodifiableTable[HashBasedTable].rowKeySet")
        .withFeatures(COLLECTION_FEATURES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            RowSortedTable<String, Integer, Character> table = TreeBasedTable.create();
            populateForRowKeySet(table, elements);
            return Tables.unmodifiableRowSortedTable(table).rowKeySet();
          }

          @Override public List<String> order(List<String> insertionOrder) {
            Collections.sort(insertionOrder);
            return insertionOrder;
          }
        })
        .named("unmodifiableRowSortedTable[TreeBasedTable].rowKeySet")
        .withFeatures(COLLECTION_FEATURES_ORDER)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<Integer, String, Character> table
                = ArrayTable.create(
                    ImmutableList.of(1, 2), ImmutableList.copyOf(elements));
            populateForColumnKeySet(table, elements);
            return table.columnKeySet();
          }
        })
        .named("ArrayTable.columnKeySet")
        .withFeatures(CollectionSize.ONE, CollectionSize.SEVERAL,
            CollectionFeature.KNOWN_ORDER,
            CollectionFeature.REJECTS_DUPLICATES_AT_CREATION,
            CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<Integer, String, Character> table = HashBasedTable.create();
            populateForColumnKeySet(table, elements);
            return table.columnKeySet();
          }
        })
        .named("HashBasedTable.columnKeySet")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<Integer, String, Character> table = TreeBasedTable.create();
            populateForColumnKeySet(table, elements);
            return table.columnKeySet();
          }

          @Override public List<String> order(List<String> insertionOrder) {
            Collections.sort(insertionOrder);
            return insertionOrder;
          }
        })
        .named("TreeBasedTable.columnKeySet")
        .withFeatures(COLLECTION_FEATURES_REMOVE_ORDER)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<Integer, String, Character> table = HashBasedTable.create();
            populateForColumnKeySet(table, elements);
            return Tables.unmodifiableTable(table).columnKeySet();
          }
        })
        .named("unmodifiableTable[HashBasedTable].columnKeySet")
        .withFeatures(COLLECTION_FEATURES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            RowSortedTable<Integer, String, Character> table = TreeBasedTable.create();
            populateForColumnKeySet(table, elements);
            return Tables.unmodifiableRowSortedTable(table).columnKeySet();
          }

          @Override public List<String> order(List<String> insertionOrder) {
            Collections.sort(insertionOrder);
            return insertionOrder;
          }
        })
        .named("unmodifiableRowSortedTable[TreeBasedTable].columnKeySet")
        .withFeatures(COLLECTION_FEATURES_ORDER)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override protected Collection<String> create(String[] elements) {
            List<Integer> rowKeys = Lists.newArrayList();
            for (int i = 0; i < elements.length; i++) {
              rowKeys.add(i);
            }
            Table<Integer, Character, String> table
                = ArrayTable.create(rowKeys, ImmutableList.of('a'));
            populateForValues(table, elements);
            return table.values();
          }
        })
        .named("ArrayTable.values")
        .withFeatures(CollectionSize.ONE, CollectionSize.SEVERAL,
            CollectionFeature.ALLOWS_NULL_VALUES,
            CollectionFeature.KNOWN_ORDER)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override protected Collection<String> create(String[] elements) {
            Table<Integer, Character, String> table = HashBasedTable.create();
            table.put(1, 'a', "foo");
            table.clear();
            populateForValues(table, elements);
            return table.values();
          }
        })
        .named("HashBasedTable.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
        .withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override protected Collection<String> create(String[] elements) {
            Table<Integer, Character, String> table = TreeBasedTable.create();
            table.put(1, 'a', "foo");
            table.clear();
            populateForValues(table, elements);
            return table.values();
          }
        })
        .named("TreeBasedTable.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE_ORDER)
        .withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .createTestSuite());

    final Function<String, String> removeFirstCharacter
        = new Function<String, String>() {
          @Override public String apply(String input) {
            return input.substring(1);
          }
        };

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override protected Collection<String> create(String[] elements) {
            Table<Integer, Character, String> table = HashBasedTable.create();
            for (int i = 0; i < elements.length; i++) {
              table.put(i, 'a', "x" + checkNotNull(elements[i]));
            }
            return Tables.transformValues(table, removeFirstCharacter).values();
          }
        })
        .named("TransformValues.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
        .withFeatures(CollectionFeature.SUPPORTS_ITERATOR_REMOVE)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override protected Collection<String> create(String[] elements) {
            Table<Integer, Character, String> table = HashBasedTable.create();
            table.put(1, 'a', "foo");
            table.clear();
            populateForValues(table, elements);
            return Tables.unmodifiableTable(table).values();
          }
        })
        .named("unmodifiableTable[HashBasedTable].values")
        .withFeatures(COLLECTION_FEATURES)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override protected Collection<String> create(String[] elements) {
            RowSortedTable<Integer, Character, String> table = TreeBasedTable.create();
            table.put(1, 'a', "foo");
            table.clear();
            populateForValues(table, elements);
            return Tables.unmodifiableRowSortedTable(table).values();
          }
        })
        .named("unmodifiableTable[TreeBasedTable].values")
        .withFeatures(COLLECTION_FEATURES_ORDER)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestCellSetGenerator() {
          @Override public SampleElements<Cell<String, Integer, Character>>
              samples() {
            return new SampleElements<Cell<String, Integer, Character>>(
                Tables.immutableCell("bar", 1, 'a'),
                Tables.immutableCell("bar", 2, 'b'),
                Tables.immutableCell("bar", 3, (Character) null),
                Tables.immutableCell("bar", 4, 'b'),
                Tables.immutableCell("bar", 5, 'b'));
          }
          @Override public Set<Cell<String, Integer, Character>> create(
              Object... elements) {
            List<Integer> columnKeys = Lists.newArrayList();
            for (Object element : elements) {
              @SuppressWarnings("unchecked")
              Cell<String, Integer, Character> cell
                  = (Cell<String, Integer, Character>) element;
              columnKeys.add(cell.getColumnKey());
            }
            Table<String, Integer, Character> table
                = ArrayTable.create(ImmutableList.of("bar"), columnKeys);
            for (Object element : elements) {
              @SuppressWarnings("unchecked")
              Cell<String, Integer, Character> cell
                  = (Cell<String, Integer, Character>) element;
              table.put(cell.getRowKey(), cell.getColumnKey(), cell.getValue());
            }
            return table.cellSet();
          }
          @Override Table<String, Integer, Character> createTable() {
            throw new UnsupportedOperationException();
          }
        })
        .named("ArrayTable.cellSet")
        .withFeatures(CollectionSize.ONE, CollectionSize.SEVERAL,
            CollectionFeature.KNOWN_ORDER,
            CollectionFeature.REJECTS_DUPLICATES_AT_CREATION,
            CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestCellSetGenerator() {
          @Override Table<String, Integer, Character> createTable() {
            return HashBasedTable.create();
          }
        })
        .named("HashBasedTable.cellSet")
        .withFeatures(CollectionSize.ANY, CollectionFeature.REMOVE_OPERATIONS,
            CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestCellSetGenerator() {
          @Override Table<String, Integer, Character> createTable() {
            return TreeBasedTable.create();
          }
        })
        .named("TreeBasedTable.cellSet")
        .withFeatures(CollectionSize.ANY, CollectionFeature.REMOVE_OPERATIONS,
            CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestCellSetGenerator() {
          @Override Table<String, Integer, Character> createTable() {
            Table<Integer, String, Character> original
                = TreeBasedTable.create();
            return Tables.transpose(original);
          }
        })
        .named("TransposedTable.cellSet")
        .withFeatures(CollectionSize.ANY, CollectionFeature.REMOVE_OPERATIONS,
            CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestCellSetGenerator() {
          @Override Table<String, Integer, Character> createTable() {
            return HashBasedTable.create();
          }
          @Override
          public Set<Cell<String, Integer, Character>> create(
              Object... elements) {
            Table<String, Integer, Character> table = createTable();
            for (Object element : elements) {
              @SuppressWarnings("unchecked")
              Cell<String, Integer, Character> cell
                  = (Cell<String, Integer, Character>) element;
              table.put(cell.getRowKey(), cell.getColumnKey(), cell.getValue());
            }
            return Tables.transformValues(table, Functions.<Character>identity()).cellSet();
          }
        })
        .named("TransformValues.cellSet")
        .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES,
            CollectionFeature.REMOVE_OPERATIONS)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestCellSetGenerator() {
          @Override Table<String, Integer, Character> createTable() {
            return Tables.unmodifiableTable(HashBasedTable.<String, Integer, Character> create());
          }
          @Override
          public Set<Cell<String, Integer, Character>> create(
              Object... elements) {
            Table<String, Integer, Character> table = HashBasedTable.create();
            for (Object element : elements) {
              @SuppressWarnings("unchecked")
              Cell<String, Integer, Character> cell
                  = (Cell<String, Integer, Character>) element;
              table.put(cell.getRowKey(), cell.getColumnKey(), cell.getValue());
            }
            return Tables.unmodifiableTable(table).cellSet();
          }
        })
        .named("unmodifiableTable[HashBasedTable].cellSet")
        .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestCellSetGenerator() {
          @Override RowSortedTable<String, Integer, Character> createTable() {
            return Tables.unmodifiableRowSortedTable(TreeBasedTable
                .<String, Integer, Character> create());
          }
          @Override
          public Set<Cell<String, Integer, Character>> create(
              Object... elements) {
            RowSortedTable<String, Integer, Character> table = TreeBasedTable.create();
            for (Object element : elements) {
              @SuppressWarnings("unchecked")
              Cell<String, Integer, Character> cell
                  = (Cell<String, Integer, Character>) element;
              table.put(cell.getRowKey(), cell.getColumnKey(), cell.getValue());
            }
            return Tables.unmodifiableRowSortedTable(table).cellSet();
          }
        })
        .named("unmodifiableRowSortedTable[TreeBasedTable].cellSet")
        .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Iterable<String> rowKeys = ImmutableSet.copyOf(elements);
            Iterable<Integer> columnKeys = ImmutableList.of(1, 2, 3);
            Table<String, Integer, Character> table
                = ArrayTable.create(rowKeys, columnKeys);
            populateForRowKeySet(table, elements);
            return table.column(1).keySet();
          }
        })
        .named("ArrayTable.column.keySet")
        .withFeatures(CollectionSize.ONE, CollectionSize.SEVERAL,
            CollectionFeature.KNOWN_ORDER,
            CollectionFeature.ALLOWS_NULL_QUERIES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<String, Integer, Character> table = HashBasedTable.create();
            populateForRowKeySet(table, elements);
            return table.column(1).keySet();
          }
        })
        .named("HashBasedTable.column.keySet")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
    .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<String, Integer, Character> table = TreeBasedTable.create();
            populateForRowKeySet(table, elements);
            return table.column(1).keySet();
          }
          @Override public List<String> order(List<String> insertionOrder) {
            Collections.sort(insertionOrder);
            return insertionOrder;
          }
        })
        .named("TreeBasedTable.column.keySet")
        .withFeatures(COLLECTION_FEATURES_REMOVE_ORDER)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<String, Integer, Character> table = HashBasedTable.create();
            populateForRowKeySet(table, elements);
            return Tables.transformValues(table, Functions.toStringFunction()).column(1).keySet();
          }
        })
        .named("TransformValues.column.keySet")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
    .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Table<String, Integer, Character> table = HashBasedTable.create();
            populateForRowKeySet(table, elements);
            return Tables.unmodifiableTable(table).column(1).keySet();
          }
        })
        .named("unmodifiableTable[HashBasedTable].column.keySet")
        .withFeatures(COLLECTION_FEATURES)
    .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            RowSortedTable<String, Integer, Character> table = TreeBasedTable.create();
            populateForRowKeySet(table, elements);
            return Tables.unmodifiableRowSortedTable(table).column(1).keySet();
          }
View Full Code Here

          MapFeature.REJECTS_DUPLICATES_AT_CREATION,
          CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite());
    suite.addTest(NavigableSetTestSuiteBuilder.using(new TestStringSetGenerator() {
        @Override
        protected Set<String> create(String[] elements) {
          TreeMultimap<Integer, String> multimap = TreeMultimap.create(
              Ordering.natural(), Ordering.natural().nullsFirst());
          multimap.putAll(1, Arrays.asList(elements));
          return multimap.get(1);
        }

        @Override
        public List<String> order(List<String> insertionOrder) {
          return Ordering.natural().nullsFirst().sortedCopy(insertionOrder);
        }
      })
      .named("TreeMultimap.get")
      .withFeatures(
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite());
    suite.addTest(NavigableSetTestSuiteBuilder.using(new TestStringSetGenerator() {
        @Override
        protected Set<String> create(String[] elements) {
          TreeMultimap<Integer, String> multimap = TreeMultimap.create(
              Ordering.natural(), Ordering.natural().nullsFirst());
          multimap.putAll(1, Arrays.asList(elements));
View Full Code Here

  public static Test suite() {
    TestSuite suite = new TestSuite();
    suite.addTestSuite(SetsTest.class);

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            int size = elements.length;
            // Remove last element, if size > 1
            Set<String> set1 = (size > 1)
                ? Sets.newHashSet(
                    Arrays.asList(elements).subList(0, size - 1))
                : Sets.newHashSet(elements);
            // Remove first element, if size > 0
            Set<String> set2 = (size > 0)
                ? Sets.newHashSet(
                    Arrays.asList(elements).subList(1, size))
                : Sets.<String>newHashSet();
            return Sets.union(set1, set2);
          }
        })
        .named("Sets.union")
        .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Set<String> set1 = Sets.newHashSet(elements);
            set1.add(samples().e3);
            Set<String> set2 = Sets.newHashSet(elements);
            set2.add(samples().e4);
            return Sets.intersection(set1, set2);
          }
        })
        .named("Sets.intersection")
        .withFeatures(CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES)
        .createTestSuite());

    suite.addTest(SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override protected Set<String> create(String[] elements) {
            Set<String> set1 = Sets.newHashSet(elements);
            set1.add(samples().e3);
            Set<String> set2 = Sets.newHashSet(samples().e3);
            return Sets.difference(set1, set2);
View Full Code Here

    return suite;
  }

  private static Test testsForFilter() {
    return SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override public Set<String> create(String[] elements) {
            Set<String> unfiltered = Sets.newLinkedHashSet();
            unfiltered.add("yyy");
            unfiltered.addAll(Arrays.asList(elements));
            unfiltered.add("zzz");
View Full Code Here

        .suppressing(getIteratorKnownOrderRemoveSupportedMethod())
        .createTestSuite();
  }

  private static Test testsForFilterNoNulls() {
    return SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override public Set<String> create(String[] elements) {
            Set<String> unfiltered = Sets.newLinkedHashSet();
            unfiltered.add("yyy");
            unfiltered.addAll(ImmutableList.of(elements));
            unfiltered.add("zzz");
View Full Code Here

        .suppressing(getIteratorKnownOrderRemoveSupportedMethod())
        .createTestSuite();
  }

  private static Test testsForFilterFiltered() {
    return SetTestSuiteBuilder.using(new TestStringSetGenerator() {
          @Override public Set<String> create(String[] elements) {
            Set<String> unfiltered = Sets.newLinkedHashSet();
            unfiltered.add("yyy");
            unfiltered.addAll(ImmutableList.of(elements));
            unfiltered.add("zzz");
View Full Code Here

TOP

Related Classes of com.google.common.collect.testing.TestStringSetGenerator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.