Package com.google.common.collect.testing

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


  };

  @GwtIncompatible("suite")
  private static Test testsForFilter() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> unfiltered = newArrayList();
            unfiltered.add("yyy");
            Collections.addAll(unfiltered, elements);
            unfiltered.add("zzz");
View Full Code Here


  }

  @GwtIncompatible("suite")
  private static Test testsForFilterAll() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> unfiltered = newArrayList();
            Collections.addAll(unfiltered, elements);
            return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
          }
View Full Code Here

  }

  @GwtIncompatible("suite")
  private static Test testsForFilterLinkedList() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> unfiltered = newLinkedList();
            unfiltered.add("yyy");
            Collections.addAll(unfiltered, elements);
            unfiltered.add("zzz");
View Full Code Here

  }

  @GwtIncompatible("suite")
  private static Test testsForFilterNoNulls() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> unfiltered = newArrayList();
            unfiltered.add("yyy");
            unfiltered.addAll(ImmutableList.copyOf(elements));
            unfiltered.add("zzz");
View Full Code Here

  }

  @GwtIncompatible("suite")
  private static Test testsForFilterFiltered() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> unfiltered = newArrayList();
            unfiltered.add("yyy");
            unfiltered.addAll(ImmutableList.copyOf(elements));
            unfiltered.add("zzz");
View Full Code Here

      };

  @GwtIncompatible("suite")
  private static Test testsForTransform() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> list = newArrayList();
            for (String element : elements) {
              list.add((element == null) ? null : "q" + element);
            }
View Full Code Here

        .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);
View Full Code Here

        .named("Multimaps.forMap.keySet")
        .withFeatures(FOR_MAP_FEATURES_ANY)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            Multimap<Integer, String> multimap = HashMultimap.create();
            populateMultimapForValues(multimap, elements);
            return multimap.values();
          }
        })
        .named("HashMultimap.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            Multimap<Integer, String> multimap
                = LinkedHashMultimap.create();
            populateMultimapForValues(multimap, elements);
            return multimap.values();
          }
        })
        .named("LinkedHashMultimap.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE_ORDER)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            Multimap<Integer, String> multimap
                = TreeMultimap.create(Ordering.natural().nullsFirst(),
                Ordering.natural().nullsLast());
            populateMultimapForValues(multimap, elements);
            return multimap.values();
          }
        })
        .named("TreeMultimap.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            Multimap<Integer, String> multimap
                = ArrayListMultimap.create();
            populateMultimapForValues(multimap, elements);
            return multimap.values();
          }
        })
        .named("ArrayListMultimap.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            Multimap<Integer, String> multimap
                = LinkedListMultimap.create();
            populateMultimapForValues(multimap, elements);
            return multimap.values();
          }
        })
        .named("LinkedListMultimap.values")
        .withFeatures(COLLECTION_FEATURES_REMOVE_ORDER)
        .createTestSuite());

    suite.addTest(CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            ImmutableListMultimap.Builder<Integer, String> builder
                = ImmutableListMultimap.builder();
            for (int i = 0; i < elements.length; i++) {
              builder.put(i % 2, elements[i]);
View Full Code Here

    }
  };

  private static Test testsForFilter() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> unfiltered = newArrayList();
            unfiltered.add("yyy");
            unfiltered.addAll(Arrays.asList(elements));
            unfiltered.add("zzz");
View Full Code Here

        .createTestSuite();
  }

  private static Test testsForFilterAll() {
    return CollectionTestSuiteBuilder.using(
        new TestStringCollectionGenerator() {
          @Override public Collection<String> create(String[] elements) {
            List<String> unfiltered = newArrayList();
            unfiltered.addAll(Arrays.asList(elements));
            return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
          }
View Full Code Here

TOP

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

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.