Java 类com.google.common.collect.testing.features.FeatureUtil 实例源码

项目:guava-mock    文件:FeatureSpecificTestSuiteBuilder.java   
/**
 * Creates a runnable JUnit test suite based on the criteria already given.
 */
/*
 * Class parameters must be raw. This annotation should go on testerClass in
 * the for loop, but the 1.5 javac crashes on annotations in for loops:
 * <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294589>
 */
@SuppressWarnings("unchecked")
public TestSuite createTestSuite() {
  checkCanCreate();

  logger.fine(" Testing: " + name);
  logger.fine("Features: " + formatFeatureSet(features));

  FeatureUtil.addImpliedFeatures(features);

  logger.fine("Expanded: " + formatFeatureSet(features));

  // Class parameters must be raw.
  List<Class<? extends AbstractTester>> testers = getTesters();

  TestSuite suite = new TestSuite(name);
  for (Class<? extends AbstractTester> testerClass : testers) {
    final TestSuite testerSuite =
        makeSuiteForTesterClass((Class<? extends AbstractTester<?>>) testerClass);
    if (testerSuite.countTestCases() > 0) {
      suite.addTest(testerSuite);
    }
  }
  return suite;
}
项目:googles-monorepo-demo    文件:FeatureSpecificTestSuiteBuilder.java   
/**
 * Creates a runnable JUnit test suite based on the criteria already given.
 */
/*
 * Class parameters must be raw. This annotation should go on testerClass in
 * the for loop, but the 1.5 javac crashes on annotations in for loops:
 * <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294589>
 */
@SuppressWarnings("unchecked")
public TestSuite createTestSuite() {
  checkCanCreate();

  logger.fine(" Testing: " + name);
  logger.fine("Features: " + formatFeatureSet(features));

  FeatureUtil.addImpliedFeatures(features);

  logger.fine("Expanded: " + formatFeatureSet(features));

  // Class parameters must be raw.
  List<Class<? extends AbstractTester>> testers = getTesters();

  TestSuite suite = new TestSuite(name);
  for (Class<? extends AbstractTester> testerClass : testers) {
    final TestSuite testerSuite =
        makeSuiteForTesterClass((Class<? extends AbstractTester<?>>) testerClass);
    if (testerSuite.countTestCases() > 0) {
      suite.addTest(testerSuite);
    }
  }
  return suite;
}
项目:guava-libraries    文件:FeatureSpecificTestSuiteBuilder.java   
/**
 * Creates a runnable JUnit test suite based on the criteria already given.
 */
/*
 * Class parameters must be raw. This annotation should go on testerClass in
 * the for loop, but the 1.5 javac crashes on annotations in for loops:
 * <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294589>
 */
@SuppressWarnings("unchecked")
public TestSuite createTestSuite() {
  checkCanCreate();

  logger.fine(" Testing: " + name);
  logger.fine("Features: " + formatFeatureSet(features));

  FeatureUtil.addImpliedFeatures(features);

  logger.fine("Expanded: " + formatFeatureSet(features));

  // Class parameters must be raw.
  List<Class<? extends AbstractTester>> testers = getTesters();

  TestSuite suite = new TestSuite(name);
  for (Class<? extends AbstractTester> testerClass : testers) {
    final TestSuite testerSuite = makeSuiteForTesterClass(
        (Class<? extends AbstractTester<?>>) testerClass);
    if (testerSuite.countTestCases() > 0) {
      suite.addTest(testerSuite);
    }
  }
  return suite;
}
项目:guava    文件:FeatureSpecificTestSuiteBuilder.java   
/** Creates a runnable JUnit test suite based on the criteria already given. */
/*
 * Class parameters must be raw. This annotation should go on testerClass in
 * the for loop, but the 1.5 javac crashes on annotations in for loops:
 * <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294589>
 */
@SuppressWarnings("unchecked")
public TestSuite createTestSuite() {
  checkCanCreate();

  logger.fine(" Testing: " + name);
  logger.fine("Features: " + formatFeatureSet(features));

  FeatureUtil.addImpliedFeatures(features);

  logger.fine("Expanded: " + formatFeatureSet(features));

  // Class parameters must be raw.
  List<Class<? extends AbstractTester>> testers = getTesters();

  TestSuite suite = new TestSuite(name);
  for (Class<? extends AbstractTester> testerClass : testers) {
    final TestSuite testerSuite =
        makeSuiteForTesterClass((Class<? extends AbstractTester<?>>) testerClass);
    if (testerSuite.countTestCases() > 0) {
      suite.addTest(testerSuite);
    }
  }
  return suite;
}
项目:guava    文件:FeatureSpecificTestSuiteBuilder.java   
/** Creates a runnable JUnit test suite based on the criteria already given. */
/*
 * Class parameters must be raw. This annotation should go on testerClass in
 * the for loop, but the 1.5 javac crashes on annotations in for loops:
 * <http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6294589>
 */
@SuppressWarnings("unchecked")
public TestSuite createTestSuite() {
  checkCanCreate();

  logger.fine(" Testing: " + name);
  logger.fine("Features: " + formatFeatureSet(features));

  FeatureUtil.addImpliedFeatures(features);

  logger.fine("Expanded: " + formatFeatureSet(features));

  // Class parameters must be raw.
  List<Class<? extends AbstractTester>> testers = getTesters();

  TestSuite suite = new TestSuite(name);
  for (Class<? extends AbstractTester> testerClass : testers) {
    final TestSuite testerSuite =
        makeSuiteForTesterClass((Class<? extends AbstractTester<?>>) testerClass);
    if (testerSuite.countTestCases() > 0) {
      suite.addTest(testerSuite);
    }
  }
  return suite;
}
项目:guava-mock    文件:PerCollectionSizeTestSuiteBuilder.java   
/**
 * Creates a runnable JUnit test suite based on the criteria already given.
 */
@Override
public TestSuite createTestSuite() {
  checkCanCreate();

  String name = getName();
  // Copy this set, so we can modify it.
  Set<Feature<?>> features = Helpers.copyToSet(getFeatures());
  List<Class<? extends AbstractTester>> testers = getTesters();

  logger.fine(" Testing: " + name);

  // Split out all the specified sizes.
  Set<Feature<?>> sizesToTest = Helpers.<Feature<?>>copyToSet(CollectionSize.values());
  sizesToTest.retainAll(features);
  features.removeAll(sizesToTest);

  FeatureUtil.addImpliedFeatures(sizesToTest);
  sizesToTest.retainAll(
      Arrays.asList(CollectionSize.ZERO, CollectionSize.ONE, CollectionSize.SEVERAL));

  logger.fine("   Sizes: " + formatFeatureSet(sizesToTest));

  if (sizesToTest.isEmpty()) {
    throw new IllegalStateException(
        name
            + ": no CollectionSizes specified (check the argument to "
            + "FeatureSpecificTestSuiteBuilder.withFeatures().)");
  }

  TestSuite suite = new TestSuite(name);
  for (Feature<?> collectionSize : sizesToTest) {
    String oneSizeName =
        Platform.format(
            "%s [collection size: %s]", name, collectionSize.toString().toLowerCase());
    OneSizeGenerator<T, E> oneSizeGenerator =
        new OneSizeGenerator<T, E>(getSubjectGenerator(), (CollectionSize) collectionSize);
    Set<Feature<?>> oneSizeFeatures = Helpers.copyToSet(features);
    oneSizeFeatures.add(collectionSize);
    Set<Method> oneSizeSuppressedTests = getSuppressedTests();

    OneSizeTestSuiteBuilder<T, E> oneSizeBuilder =
        new OneSizeTestSuiteBuilder<T, E>(testers)
            .named(oneSizeName)
            .usingGenerator(oneSizeGenerator)
            .withFeatures(oneSizeFeatures)
            .withSetUp(getSetUp())
            .withTearDown(getTearDown())
            .suppressing(oneSizeSuppressedTests);
    TestSuite oneSizeSuite = oneSizeBuilder.createTestSuite();
    suite.addTest(oneSizeSuite);

    for (TestSuite derivedSuite : createDerivedSuites(oneSizeBuilder)) {
      oneSizeSuite.addTest(derivedSuite);
    }
  }
  return suite;
}
项目:googles-monorepo-demo    文件:PerCollectionSizeTestSuiteBuilder.java   
/**
 * Creates a runnable JUnit test suite based on the criteria already given.
 */
@Override
public TestSuite createTestSuite() {
  checkCanCreate();

  String name = getName();
  // Copy this set, so we can modify it.
  Set<Feature<?>> features = Helpers.copyToSet(getFeatures());
  List<Class<? extends AbstractTester>> testers = getTesters();

  logger.fine(" Testing: " + name);

  // Split out all the specified sizes.
  Set<Feature<?>> sizesToTest = Helpers.<Feature<?>>copyToSet(CollectionSize.values());
  sizesToTest.retainAll(features);
  features.removeAll(sizesToTest);

  FeatureUtil.addImpliedFeatures(sizesToTest);
  sizesToTest.retainAll(
      Arrays.asList(CollectionSize.ZERO, CollectionSize.ONE, CollectionSize.SEVERAL));

  logger.fine("   Sizes: " + formatFeatureSet(sizesToTest));

  if (sizesToTest.isEmpty()) {
    throw new IllegalStateException(
        name
            + ": no CollectionSizes specified (check the argument to "
            + "FeatureSpecificTestSuiteBuilder.withFeatures().)");
  }

  TestSuite suite = new TestSuite(name);
  for (Feature<?> collectionSize : sizesToTest) {
    String oneSizeName =
        Platform.format(
            "%s [collection size: %s]", name, collectionSize.toString().toLowerCase());
    OneSizeGenerator<T, E> oneSizeGenerator =
        new OneSizeGenerator<T, E>(getSubjectGenerator(), (CollectionSize) collectionSize);
    Set<Feature<?>> oneSizeFeatures = Helpers.copyToSet(features);
    oneSizeFeatures.add(collectionSize);
    Set<Method> oneSizeSuppressedTests = getSuppressedTests();

    OneSizeTestSuiteBuilder<T, E> oneSizeBuilder =
        new OneSizeTestSuiteBuilder<T, E>(testers)
            .named(oneSizeName)
            .usingGenerator(oneSizeGenerator)
            .withFeatures(oneSizeFeatures)
            .withSetUp(getSetUp())
            .withTearDown(getTearDown())
            .suppressing(oneSizeSuppressedTests);
    TestSuite oneSizeSuite = oneSizeBuilder.createTestSuite();
    suite.addTest(oneSizeSuite);

    for (TestSuite derivedSuite : createDerivedSuites(oneSizeBuilder)) {
      oneSizeSuite.addTest(derivedSuite);
    }
  }
  return suite;
}
项目:guava-libraries    文件:PerCollectionSizeTestSuiteBuilder.java   
/**
 * Creates a runnable JUnit test suite based on the criteria already given.
 */
@Override public TestSuite createTestSuite() {
  checkCanCreate();

  String name = getName();
  // Copy this set, so we can modify it.
  Set<Feature<?>> features = Helpers.copyToSet(getFeatures());
  List<Class<? extends AbstractTester>> testers = getTesters();

  logger.fine(" Testing: " + name);

  // Split out all the specified sizes.
  Set<Feature<?>> sizesToTest =
      Helpers.<Feature<?>>copyToSet(CollectionSize.values());
  sizesToTest.retainAll(features);
  features.removeAll(sizesToTest);

  FeatureUtil.addImpliedFeatures(sizesToTest);
  sizesToTest.retainAll(Arrays.asList(
      CollectionSize.ZERO, CollectionSize.ONE, CollectionSize.SEVERAL));

  logger.fine("   Sizes: " + formatFeatureSet(sizesToTest));

  if (sizesToTest.isEmpty()) {
    throw new IllegalStateException(name
        + ": no CollectionSizes specified (check the argument to "
        + "FeatureSpecificTestSuiteBuilder.withFeatures().)");
  }

  TestSuite suite = new TestSuite(name);
  for (Feature<?> collectionSize : sizesToTest) {
    String oneSizeName = Platform.format("%s [collection size: %s]",
        name, collectionSize.toString().toLowerCase());
    OneSizeGenerator<T, E> oneSizeGenerator = new OneSizeGenerator<T, E>(
        getSubjectGenerator(), (CollectionSize) collectionSize);
    Set<Feature<?>> oneSizeFeatures = Helpers.copyToSet(features);
    oneSizeFeatures.add(collectionSize);
    Set<Method> oneSizeSuppressedTests = getSuppressedTests();

    OneSizeTestSuiteBuilder<T, E> oneSizeBuilder =
        new OneSizeTestSuiteBuilder<T, E>(testers)
            .named(oneSizeName)
            .usingGenerator(oneSizeGenerator)
            .withFeatures(oneSizeFeatures)
            .withSetUp(getSetUp())
            .withTearDown(getTearDown())
            .suppressing(oneSizeSuppressedTests);
    TestSuite oneSizeSuite = oneSizeBuilder.createTestSuite();
    suite.addTest(oneSizeSuite);

    for (TestSuite derivedSuite : createDerivedSuites(oneSizeBuilder)) {
      oneSizeSuite.addTest(derivedSuite);
    }
  }
  return suite;
}
项目:guava    文件:PerCollectionSizeTestSuiteBuilder.java   
/** Creates a runnable JUnit test suite based on the criteria already given. */
@Override
public TestSuite createTestSuite() {
  checkCanCreate();

  String name = getName();
  // Copy this set, so we can modify it.
  Set<Feature<?>> features = Helpers.copyToSet(getFeatures());
  List<Class<? extends AbstractTester>> testers = getTesters();

  logger.fine(" Testing: " + name);

  // Split out all the specified sizes.
  Set<Feature<?>> sizesToTest = Helpers.<Feature<?>>copyToSet(CollectionSize.values());
  sizesToTest.retainAll(features);
  features.removeAll(sizesToTest);

  FeatureUtil.addImpliedFeatures(sizesToTest);
  sizesToTest.retainAll(
      Arrays.asList(CollectionSize.ZERO, CollectionSize.ONE, CollectionSize.SEVERAL));

  logger.fine("   Sizes: " + formatFeatureSet(sizesToTest));

  if (sizesToTest.isEmpty()) {
    throw new IllegalStateException(
        name
            + ": no CollectionSizes specified (check the argument to "
            + "FeatureSpecificTestSuiteBuilder.withFeatures().)");
  }

  TestSuite suite = new TestSuite(name);
  for (Feature<?> collectionSize : sizesToTest) {
    String oneSizeName =
        Platform.format(
            "%s [collection size: %s]", name, collectionSize.toString().toLowerCase());
    OneSizeGenerator<T, E> oneSizeGenerator =
        new OneSizeGenerator<>(getSubjectGenerator(), (CollectionSize) collectionSize);
    Set<Feature<?>> oneSizeFeatures = Helpers.copyToSet(features);
    oneSizeFeatures.add(collectionSize);
    Set<Method> oneSizeSuppressedTests = getSuppressedTests();

    OneSizeTestSuiteBuilder<T, E> oneSizeBuilder =
        new OneSizeTestSuiteBuilder<T, E>(testers)
            .named(oneSizeName)
            .usingGenerator(oneSizeGenerator)
            .withFeatures(oneSizeFeatures)
            .withSetUp(getSetUp())
            .withTearDown(getTearDown())
            .suppressing(oneSizeSuppressedTests);
    TestSuite oneSizeSuite = oneSizeBuilder.createTestSuite();
    suite.addTest(oneSizeSuite);

    for (TestSuite derivedSuite : createDerivedSuites(oneSizeBuilder)) {
      oneSizeSuite.addTest(derivedSuite);
    }
  }
  return suite;
}
项目:guava    文件:PerCollectionSizeTestSuiteBuilder.java   
/** Creates a runnable JUnit test suite based on the criteria already given. */
@Override
public TestSuite createTestSuite() {
  checkCanCreate();

  String name = getName();
  // Copy this set, so we can modify it.
  Set<Feature<?>> features = Helpers.copyToSet(getFeatures());
  List<Class<? extends AbstractTester>> testers = getTesters();

  logger.fine(" Testing: " + name);

  // Split out all the specified sizes.
  Set<Feature<?>> sizesToTest = Helpers.<Feature<?>>copyToSet(CollectionSize.values());
  sizesToTest.retainAll(features);
  features.removeAll(sizesToTest);

  FeatureUtil.addImpliedFeatures(sizesToTest);
  sizesToTest.retainAll(
      Arrays.asList(CollectionSize.ZERO, CollectionSize.ONE, CollectionSize.SEVERAL));

  logger.fine("   Sizes: " + formatFeatureSet(sizesToTest));

  if (sizesToTest.isEmpty()) {
    throw new IllegalStateException(
        name
            + ": no CollectionSizes specified (check the argument to "
            + "FeatureSpecificTestSuiteBuilder.withFeatures().)");
  }

  TestSuite suite = new TestSuite(name);
  for (Feature<?> collectionSize : sizesToTest) {
    String oneSizeName =
        Platform.format(
            "%s [collection size: %s]", name, collectionSize.toString().toLowerCase());
    OneSizeGenerator<T, E> oneSizeGenerator =
        new OneSizeGenerator<>(getSubjectGenerator(), (CollectionSize) collectionSize);
    Set<Feature<?>> oneSizeFeatures = Helpers.copyToSet(features);
    oneSizeFeatures.add(collectionSize);
    Set<Method> oneSizeSuppressedTests = getSuppressedTests();

    OneSizeTestSuiteBuilder<T, E> oneSizeBuilder =
        new OneSizeTestSuiteBuilder<T, E>(testers)
            .named(oneSizeName)
            .usingGenerator(oneSizeGenerator)
            .withFeatures(oneSizeFeatures)
            .withSetUp(getSetUp())
            .withTearDown(getTearDown())
            .suppressing(oneSizeSuppressedTests);
    TestSuite oneSizeSuite = oneSizeBuilder.createTestSuite();
    suite.addTest(oneSizeSuite);

    for (TestSuite derivedSuite : createDerivedSuites(oneSizeBuilder)) {
      oneSizeSuite.addTest(derivedSuite);
    }
  }
  return suite;
}