Java Code Examples for com.google.common.collect.testing.SetTestSuiteBuilder

The following are top voted examples for showing how to use com.google.common.collect.testing.SetTestSuiteBuilder. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: guava-mock   File: SetMultimapTestSuiteBuilder.java   Source Code and License 6 votes vote down vote up
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SetTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
Example 2
Project: guava-mock   File: SynchronizedSetTest.java   Source Code and License 6 votes vote down vote up
public static Test suite() {
  return SetTestSuiteBuilder.using(
          new TestStringSetGenerator() {
            @Override
            protected Set<String> create(String[] elements) {
              TestSet<String> inner = new TestSet<String>(new HashSet<String>(), null);
              Set<String> outer = Synchronized.set(inner, null);
              inner.mutex = outer;
              Collections.addAll(outer, elements);
              return outer;
            }
          })
      .named("Synchronized.set")
      .withFeatures(
          CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ANY,
          CollectionFeature.SERIALIZABLE)
      .createTestSuite();
}
 
Example 3
Project: guava-mock   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // 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");
          Collections.addAll(unfiltered, elements);
          unfiltered.add("zzz");
          return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
        }
      })
      .named("Sets.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 4
Project: guava-mock   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // suite
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.copyOf(elements));
          unfiltered.add("zzz");
          unfiltered.add("abc");
          return Sets.filter(
              Sets.filter(unfiltered, Collections2Test.LENGTH_1),
              Collections2Test.NOT_YYY_ZZZ);
        }
      })
      .named("Sets.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY,
          CollectionFeature.ALLOWS_NULL_QUERIES)
      .createTestSuite();
}
 
Example 5
Project: googles-monorepo-demo   File: SetMultimapTestSuiteBuilder.java   Source Code and License 6 votes vote down vote up
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SetTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
Example 6
Project: googles-monorepo-demo   File: SynchronizedSetTest.java   Source Code and License 6 votes vote down vote up
public static Test suite() {
  return SetTestSuiteBuilder.using(
          new TestStringSetGenerator() {
            @Override
            protected Set<String> create(String[] elements) {
              TestSet<String> inner = new TestSet<String>(new HashSet<String>(), null);
              Set<String> outer = Synchronized.set(inner, null);
              inner.mutex = outer;
              Collections.addAll(outer, elements);
              return outer;
            }
          })
      .named("Synchronized.set")
      .withFeatures(
          CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ANY,
          CollectionFeature.SERIALIZABLE)
      .createTestSuite();
}
 
Example 7
Project: googles-monorepo-demo   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // 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");
          Collections.addAll(unfiltered, elements);
          unfiltered.add("zzz");
          return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
        }
      })
      .named("Sets.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 8
Project: googles-monorepo-demo   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // suite
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.copyOf(elements));
          unfiltered.add("zzz");
          unfiltered.add("abc");
          return Sets.filter(
              Sets.filter(unfiltered, Collections2Test.LENGTH_1),
              Collections2Test.NOT_YYY_ZZZ);
        }
      })
      .named("Sets.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY,
          CollectionFeature.ALLOWS_NULL_QUERIES)
      .createTestSuite();
}
 
Example 9
Project: guava-libraries   File: SetMultimapTestSuiteBuilder.java   Source Code and License 6 votes vote down vote up
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ? extends
    OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SetTestSuiteBuilder.using(
        new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
Example 10
Project: guava-libraries   File: SynchronizedSetTest.java   Source Code and License 6 votes vote down vote up
public static Test suite() {
  return SetTestSuiteBuilder.using(new TestStringSetGenerator() {
        @Override
        protected Set<String> create(String[] elements) {
          TestSet<String> inner = new TestSet<String>(new HashSet<String>(), MUTEX);
          Set<String> outer = Synchronized.set(inner, inner.mutex);
          Collections.addAll(outer, elements);
          return outer;
        }
      })
      .named("Synchronized.set")
      .withFeatures(CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ANY,
          CollectionFeature.SERIALIZABLE)
      .createTestSuite();
}
 
Example 11
Project: guava-libraries   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible("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");
          Collections.addAll(unfiltered, elements);
          unfiltered.add("zzz");
          return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
        }
      })
      .named("Sets.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 12
Project: guava-libraries   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible("suite")
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.copyOf(elements));
          unfiltered.add("zzz");
          unfiltered.add("abc");
          return Sets.filter(
              Sets.filter(unfiltered, Collections2Test.LENGTH_1),
              Collections2Test.NOT_YYY_ZZZ);
        }
      })
      .named("Sets.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY,
          CollectionFeature.ALLOWS_NULL_QUERIES)
      .createTestSuite();
}
 
Example 13
Project: NetworkParser   File: GuavaTest.java   Source Code and License 6 votes vote down vote up
public Test testsForHashSet() {
	    return SetTestSuiteBuilder
	        .using(new TestStringSetGenerator() {
	            @SuppressWarnings("unchecked")
				@Override public Set<String> create(String[] elements) {
	              Set<String> list = new HashSet<String>();
	              list.addAll(MinimalCollection.of(elements));
	              return list;
	            }
	          })
	        .named("HashSet")
	        .withFeatures(
	            SetFeature.GENERAL_PURPOSE,
	            CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
	            CollectionSize.ANY)
	        .suppressing(suppressForHashSet())
	        .createTestSuite();
//        CollectionFeature.ALLOWS_NULL_VALUES,
//	    CollectionFeature.SERIALIZABLE,
	  }
 
Example 14
Project: NetworkParser   File: GuavaTest.java   Source Code and License 6 votes vote down vote up
public Test testsForSimpleList() {
	    return SetTestSuiteBuilder
	        .using(new TestStringSetGenerator() {
	            @SuppressWarnings("unchecked")
				@Override public Set<String> create(String[] elements) {
//	              return (Set<String>) new HashSet<String>();
	            	return (Set<String>) new SimpleSet<String>().withList(MinimalCollection.of(elements));
	            }
	          })
	        .named("SimpleList")
	        .withFeatures(
	            SetFeature.GENERAL_PURPOSE,
	            CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
	            CollectionSize.ANY)
	        .suppressing(suppressForHashSet())
	        .createTestSuite();
//        CollectionFeature.ALLOWS_NULL_VALUES,
//	    CollectionFeature.SERIALIZABLE,
	  }
 
Example 15
Project: pareto4j   File: ParetoHashSetTestSuite.java   Source Code and License 6 votes vote down vote up
public static TestSuite suite() throws Exception {
    return SetTestSuiteBuilder.using(new TestStringSetGenerator() {

        @Override
        protected Set<String> create(String[] elements) {
            ParetoHashSet s = new ParetoHashSet();
            for (String element : elements) {
                s.add(element);
            }
            return s;
        }
    })
            .named("ParetoHashSetTestSuite")
            .withFeatures(SetFeature.GENERAL_PURPOSE, CollectionSize.ANY, CollectionFeature.ALLOWS_NULL_VALUES,
                    CollectionFeature.ALLOWS_NULL_QUERIES, CollectionFeature.REMOVE_OPERATIONS,
                    CollectionFeature.SERIALIZABLE)
            .createTestSuite();
}
 
Example 16
Project: guava   File: SetMultimapTestSuiteBuilder.java   Source Code and License 6 votes vote down vote up
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SetTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
Example 17
Project: guava   File: SetMultimapTestSuiteBuilder.java   Source Code and License 6 votes vote down vote up
@Override
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return SetTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
Example 18
Project: guava   File: SynchronizedSetTest.java   Source Code and License 6 votes vote down vote up
public static Test suite() {
  return SetTestSuiteBuilder.using(
          new TestStringSetGenerator() {
            @Override
            protected Set<String> create(String[] elements) {
              TestSet<String> inner = new TestSet<>(new HashSet<String>(), MUTEX);
              Set<String> outer = Synchronized.set(inner, inner.mutex);
              Collections.addAll(outer, elements);
              return outer;
            }
          })
      .named("Synchronized.set")
      .withFeatures(
          CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ANY,
          CollectionFeature.SERIALIZABLE)
      .createTestSuite();
}
 
Example 19
Project: guava   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // 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");
              Collections.addAll(unfiltered, elements);
              unfiltered.add("zzz");
              return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
            }
          })
      .named("Sets.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 20
Project: guava   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // suite
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.copyOf(elements));
              unfiltered.add("zzz");
              unfiltered.add("abc");
              return Sets.filter(
                  Sets.filter(unfiltered, Collections2Test.LENGTH_1),
                  Collections2Test.NOT_YYY_ZZZ);
            }
          })
      .named("Sets.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY,
          CollectionFeature.ALLOWS_NULL_QUERIES)
      .createTestSuite();
}
 
Example 21
Project: guava   File: SynchronizedSetTest.java   Source Code and License 6 votes vote down vote up
public static Test suite() {
  return SetTestSuiteBuilder.using(
          new TestStringSetGenerator() {
            @Override
            protected Set<String> create(String[] elements) {
              TestSet<String> inner = new TestSet<>(new HashSet<String>(), null);
              Set<String> outer = Synchronized.set(inner, null);
              inner.mutex = outer;
              Collections.addAll(outer, elements);
              return outer;
            }
          })
      .named("Synchronized.set")
      .withFeatures(
          CollectionFeature.GENERAL_PURPOSE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionSize.ANY,
          CollectionFeature.SERIALIZABLE)
      .createTestSuite();
}
 
Example 22
Project: guava   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // 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");
              Collections.addAll(unfiltered, elements);
              unfiltered.add("zzz");
              return Sets.filter(unfiltered, Collections2Test.NOT_YYY_ZZZ);
            }
          })
      .named("Sets.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 23
Project: guava   File: SetsTest.java   Source Code and License 6 votes vote down vote up
@GwtIncompatible // suite
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.copyOf(elements));
              unfiltered.add("zzz");
              unfiltered.add("abc");
              return Sets.filter(
                  Sets.filter(unfiltered, Collections2Test.LENGTH_1),
                  Collections2Test.NOT_YYY_ZZZ);
            }
          })
      .named("Sets.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY,
          CollectionFeature.ALLOWS_NULL_QUERIES)
      .createTestSuite();
}
 
Example 24
Project: guava-mock   File: MultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
protected List<TestSuite> createDerivedSuites(
    FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>>
        parentBuilder) {
  List<TestSuite> derivedSuites =
      new ArrayList<TestSuite>(super.createDerivedSuites(parentBuilder));

  derivedSuites.add(createElementSetTestSuite(parentBuilder));

  if (!parentBuilder.getFeatures().contains(NoRecurse.NO_ENTRY_SET)) {
    derivedSuites.add(
        SetTestSuiteBuilder.using(new EntrySetGenerator<E>(parentBuilder.getSubjectGenerator()))
            .named(getName() + ".entrySet")
            .withFeatures(computeEntrySetFeatures(parentBuilder.getFeatures()))
            .suppressing(parentBuilder.getSuppressedTests())
            .createTestSuite());
  }

  if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
    derivedSuites.add(
        MultisetTestSuiteBuilder.using(
                new ReserializedMultisetGenerator<E>(parentBuilder.getSubjectGenerator()))
            .named(getName() + " reserialized")
            .withFeatures(computeReserializedMultisetFeatures(parentBuilder.getFeatures()))
            .suppressing(parentBuilder.getSuppressedTests())
            .createTestSuite());
  }
  return derivedSuites;
}
 
Example 25
Project: guava-mock   File: MultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite createElementSetTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator()))
      .named(getName() + ".elementSet")
      .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures()))
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 26
Project: guava-mock   File: SetMultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new MultimapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 27
Project: guava-mock   File: SetMultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite computeEntriesTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Map.Entry<K, V>>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new EntriesGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".entries")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 28
Project: guava-mock   File: SortedMultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite createElementSetTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>>
        parentBuilder) {
  // TODO(lowasser): make a SortedElementSetGenerator
  return SetTestSuiteBuilder.using(
          new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator()))
      .named(getName() + ".elementSet")
      .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures()))
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 29
Project: googles-monorepo-demo   File: MultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
protected List<TestSuite> createDerivedSuites(
    FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>>
        parentBuilder) {
  List<TestSuite> derivedSuites =
      new ArrayList<TestSuite>(super.createDerivedSuites(parentBuilder));

  derivedSuites.add(createElementSetTestSuite(parentBuilder));

  if (!parentBuilder.getFeatures().contains(NoRecurse.NO_ENTRY_SET)) {
    derivedSuites.add(
        SetTestSuiteBuilder.using(new EntrySetGenerator<E>(parentBuilder.getSubjectGenerator()))
            .named(getName() + ".entrySet")
            .withFeatures(computeEntrySetFeatures(parentBuilder.getFeatures()))
            .suppressing(parentBuilder.getSuppressedTests())
            .createTestSuite());
  }

  if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
    derivedSuites.add(
        MultisetTestSuiteBuilder.using(
                new ReserializedMultisetGenerator<E>(parentBuilder.getSubjectGenerator()))
            .named(getName() + " reserialized")
            .withFeatures(computeReserializedMultisetFeatures(parentBuilder.getFeatures()))
            .suppressing(parentBuilder.getSuppressedTests())
            .createTestSuite());
  }
  return derivedSuites;
}
 
Example 30
Project: googles-monorepo-demo   File: MultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite createElementSetTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator()))
      .named(getName() + ".elementSet")
      .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures()))
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 31
Project: googles-monorepo-demo   File: SetMultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new MultimapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 32
Project: googles-monorepo-demo   File: SetMultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite computeEntriesTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<SetMultimap<K, V>, Map.Entry<K, V>>>
        parentBuilder) {
  return SetTestSuiteBuilder.using(
          new EntriesGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".entries")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 33
Project: googles-monorepo-demo   File: SortedMultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite createElementSetTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>>
        parentBuilder) {
  // TODO(lowasser): make a SortedElementSetGenerator
  return SetTestSuiteBuilder.using(
          new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator()))
      .named(getName() + ".elementSet")
      .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures()))
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 34
Project: boxes   File: SetBoxTest.java   Source Code and License 5 votes vote down vote up
public static TestSuite suite() {
    return SetTestSuiteBuilder
            .using(new TestStringSetGenerator() {

                @Override
                protected Set<String> create(String[] elements) {
                    SetBox<String> inner = new SetBox<String>(SetBoxTest.class, "list");
                    inner.set(new HashSet<String>(Arrays.asList(elements)));
                    SetBox<String> outer = new SetBox<String>(BoxFamily.getInstance(SetBoxTest.class, "list"));
                    outer.set(inner);
                    return outer;
                }


            })
            .named("ListBox")
            .withFeatures(
                    CollectionFeature.ALLOWS_NULL_QUERIES,
                    CollectionFeature.ALLOWS_NULL_VALUES,
                    CollectionFeature.DESCENDING_VIEW,
                    CollectionFeature.GENERAL_PURPOSE,
                    CollectionFeature.FAILS_FAST_ON_CONCURRENT_MODIFICATION,
                    CollectionFeature.SUBSET_VIEW,
                    CollectionFeature.SUPPORTS_ADD,
                    CollectionFeature.SUPPORTS_ITERATOR_REMOVE,
                    CollectionFeature.SUPPORTS_REMOVE,
                    CollectionSize.ANY,
                    SetFeature.GENERAL_PURPOSE
            ).createTestSuite();
}
 
Example 35
Project: guava-libraries   File: MultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
protected List<TestSuite> createDerivedSuites(FeatureSpecificTestSuiteBuilder<
    ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) {
  List<TestSuite> derivedSuites = new ArrayList<TestSuite>(
      super.createDerivedSuites(parentBuilder));

  derivedSuites.add(createElementSetTestSuite(parentBuilder));

  if (!parentBuilder.getFeatures().contains(NoRecurse.NO_ENTRY_SET)) {
    derivedSuites.add(
        SetTestSuiteBuilder.using(new EntrySetGenerator<E>(parentBuilder.getSubjectGenerator()))
            .named(getName() + ".entrySet")
            .withFeatures(computeEntrySetFeatures(parentBuilder.getFeatures()))
            .suppressing(parentBuilder.getSuppressedTests())
            .createTestSuite());
  }

  if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {
    derivedSuites.add(MultisetTestSuiteBuilder
        .using(new ReserializedMultisetGenerator<E>(parentBuilder.getSubjectGenerator()))
        .named(getName() + " reserialized")
        .withFeatures(computeReserializedMultisetFeatures(parentBuilder.getFeatures()))
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite());
  }
  return derivedSuites;
}
 
Example 36
Project: guava-libraries   File: MultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite createElementSetTestSuite(FeatureSpecificTestSuiteBuilder<
    ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) {
  return SetTestSuiteBuilder
      .using(new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator()))
      .named(getName() + ".elementSet")
      .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures()))
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 37
Project: guava-libraries   File: SetMultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ? extends
    OneSizeTestContainerGenerator<SetMultimap<K, V>, Entry<K, V>>> parentBuilder) {
  return SetTestSuiteBuilder.using(
      new MultimapGetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 38
Project: guava-libraries   File: SetMultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite computeEntriesTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ?  extends
        OneSizeTestContainerGenerator<SetMultimap<K, V>, Map.Entry<K, V>>> parentBuilder) {
  return SetTestSuiteBuilder.using(
      new EntriesGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".entries")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 39
Project: guava-libraries   File: BiMapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
createDerivedSuites(
        FeatureSpecificTestSuiteBuilder<?,
            ? extends OneSizeTestContainerGenerator<BiMap<K, V>, Entry<K, V>>> parentBuilder) {
  List<TestSuite> derived = super.createDerivedSuites(parentBuilder);
  // TODO(cpovirk): consider using this approach (derived suites instead of extension) in
  // ListTestSuiteBuilder, etc.?
  derived.add(MapTestSuiteBuilder
      .using(new MapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(parentBuilder.getFeatures())
      .named(parentBuilder.getName() + " [Map]")
      .suppressing(parentBuilder.getSuppressedTests())
      .suppressing(SetCreationTester.class.getMethods())
         // BiMap.entrySet() duplicate-handling behavior is too confusing for SetCreationTester
      .createTestSuite());
  /*
   * TODO(cpovirk): the Map tests duplicate most of this effort by using a
   * CollectionTestSuiteBuilder on values(). It would be nice to avoid that
   */
  derived.add(SetTestSuiteBuilder
      .using(new BiMapValueSetGenerator<K, V>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeValuesSetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + " values [Set]")
      .suppressing(parentBuilder.getSuppressedTests())
      .suppressing(SetCreationTester.class.getMethods())
        // BiMap.values() duplicate-handling behavior is too confusing for SetCreationTester
      .createTestSuite());
  if (!parentBuilder.getFeatures().contains(NoRecurse.INVERSE)) {
    derived.add(BiMapTestSuiteBuilder
        .using(new InverseBiMapGenerator<K, V>(parentBuilder.getSubjectGenerator()))
        .withFeatures(computeInverseFeatures(parentBuilder.getFeatures()))
        .named(parentBuilder.getName() + " inverse")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite());
  }

  return derived;
}
 
Example 40
Project: guava-libraries   File: SortedMultisetTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
@Override
TestSuite createElementSetTestSuite(FeatureSpecificTestSuiteBuilder<
    ?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) {
  // TODO(user): make a SortedElementSetGenerator
  return SetTestSuiteBuilder
      .using(new ElementSetGenerator<E>(parentBuilder.getSubjectGenerator()))
      .named(getName() + ".elementSet")
      .withFeatures(computeElementSetFeatures(parentBuilder.getFeatures()))
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}