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

The following are top voted examples for showing how to use com.google.common.collect.testing.CollectionTestSuiteBuilder. 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: MultimapTestSuiteBuilder.java   Source Code and License 6 votes vote down vote up
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return CollectionTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
Example 2
Project: guava-mock   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 3
Project: guava-mock   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 4
Project: guava-mock   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 5
Project: guava-mock   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, LENGTH_1);
        }
      })
      .named("Collections2.filter, no nulls")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 6
Project: guava-mock   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          unfiltered.add("abc");
          return Collections2.filter(
              Collections2.filter(unfiltered, LENGTH_1), NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 7
Project: guava-mock   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
          }
          return Collections2.transform(list, REMOVE_FIRST_CHAR);
        }
      })
      .named("Collections2.transform")
      .withFeatures(
          CollectionFeature.REMOVE_OPERATIONS,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 8
Project: googles-monorepo-demo   File: MultimapTestSuiteBuilder.java   Source Code and License 6 votes vote down vote up
TestSuite computeMultimapAsMapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  Set<Feature<?>> features = computeMultimapAsMapGetFeatures(parentBuilder.getFeatures());
  if (Collections.disjoint(features, EnumSet.allOf(CollectionSize.class))) {
    return new TestSuite();
  } else {
    return CollectionTestSuiteBuilder.using(
            new MultimapAsMapGetGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
        .withFeatures(features)
        .named(parentBuilder.getName() + ".asMap[].get[key]")
        .suppressing(parentBuilder.getSuppressedTests())
        .createTestSuite();
  }
}
 
Example 9
Project: googles-monorepo-demo   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 10
Project: googles-monorepo-demo   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 11
Project: googles-monorepo-demo   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 12
Project: googles-monorepo-demo   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, LENGTH_1);
        }
      })
      .named("Collections2.filter, no nulls")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 13
Project: googles-monorepo-demo   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          unfiltered.add("abc");
          return Collections2.filter(
              Collections2.filter(unfiltered, LENGTH_1), NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 14
Project: googles-monorepo-demo   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
          }
          return Collections2.transform(list, REMOVE_FIRST_CHAR);
        }
      })
      .named("Collections2.transform")
      .withFeatures(
          CollectionFeature.REMOVE_OPERATIONS,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 15
Project: guava-libraries   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 16
Project: guava-libraries   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 17
Project: guava-libraries   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 18
Project: guava-libraries   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          return Collections2.filter(unfiltered, LENGTH_1);
        }
      })
      .named("Collections2.filter, no nulls")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 19
Project: guava-libraries   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
          unfiltered.add("abc");
          return Collections2.filter(
              Collections2.filter(unfiltered, LENGTH_1), NOT_YYY_ZZZ);
        }
      })
      .named("Collections2.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 20
Project: guava-libraries   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
          }
          return Collections2.transform(list, REMOVE_FIRST_CHAR);
        }
      })
      .named("Collections2.transform")
      .withFeatures(
          CollectionFeature.REMOVE_OPERATIONS,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 21
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
            }
          })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 22
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
            }
          })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 23
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
            }
          })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 24
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              return Collections2.filter(unfiltered, LENGTH_1);
            }
          })
      .named("Collections2.filter, no nulls")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 25
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              unfiltered.add("abc");
              return Collections2.filter(Collections2.filter(unfiltered, LENGTH_1), NOT_YYY_ZZZ);
            }
          })
      .named("Collections2.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 26
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
              }
              return Collections2.transform(list, REMOVE_FIRST_CHAR);
            }
          })
      .named("Collections2.transform")
      .withFeatures(
          CollectionFeature.REMOVE_OPERATIONS,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 27
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
            }
          })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 28
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
            }
          })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 29
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              return Collections2.filter(unfiltered, NOT_YYY_ZZZ);
            }
          })
      .named("Collections2.filter")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 30
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              return Collections2.filter(unfiltered, LENGTH_1);
            }
          })
      .named("Collections2.filter, no nulls")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 31
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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");
              unfiltered.add("abc");
              return Collections2.filter(Collections2.filter(unfiltered, LENGTH_1), NOT_YYY_ZZZ);
            }
          })
      .named("Collections2.filter, filtered input")
      .withFeatures(
          CollectionFeature.SUPPORTS_ADD,
          CollectionFeature.SUPPORTS_REMOVE,
          CollectionFeature.KNOWN_ORDER,
          CollectionFeature.ALLOWS_NULL_QUERIES,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 32
Project: guava   File: Collections2Test.java   Source Code and License 6 votes vote down vote up
@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);
              }
              return Collections2.transform(list, REMOVE_FIRST_CHAR);
            }
          })
      .named("Collections2.transform")
      .withFeatures(
          CollectionFeature.REMOVE_OPERATIONS,
          CollectionFeature.ALLOWS_NULL_VALUES,
          CollectionFeature.KNOWN_ORDER,
          CollectionSize.ANY)
      .createTestSuite();
}
 
Example 33
Project: guava-mock   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeValuesTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  return CollectionTestSuiteBuilder.using(
          new ValuesGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeValuesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".values")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 34
Project: guava-mock   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeEntriesTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  return CollectionTestSuiteBuilder.using(
          new EntriesGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".entries")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 35
Project: guava-mock   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  return CollectionTestSuiteBuilder.using(
          new MultimapGetGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 36
Project: googles-monorepo-demo   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeValuesTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  return CollectionTestSuiteBuilder.using(
          new ValuesGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeValuesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".values")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 37
Project: googles-monorepo-demo   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeEntriesTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  return CollectionTestSuiteBuilder.using(
          new EntriesGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".entries")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 38
Project: googles-monorepo-demo   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeMultimapGetTestSuite(
    FeatureSpecificTestSuiteBuilder<
            ?, ? extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>>
        parentBuilder) {
  return CollectionTestSuiteBuilder.using(
          new MultimapGetGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeMultimapGetFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".get[key]")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 39
Project: guava-libraries   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeValuesTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ?
        extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) {
  return CollectionTestSuiteBuilder.using(
      new ValuesGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeValuesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".values")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}
 
Example 40
Project: guava-libraries   File: MultimapTestSuiteBuilder.java   Source Code and License 5 votes vote down vote up
TestSuite computeEntriesTestSuite(
    FeatureSpecificTestSuiteBuilder<?, ?
        extends OneSizeTestContainerGenerator<M, Map.Entry<K, V>>> parentBuilder) {
  return CollectionTestSuiteBuilder.using(
      new EntriesGenerator<K, V, M>(parentBuilder.getSubjectGenerator()))
      .withFeatures(computeEntriesFeatures(parentBuilder.getFeatures()))
      .named(parentBuilder.getName() + ".entries")
      .suppressing(parentBuilder.getSuppressedTests())
      .createTestSuite();
}