com.pholser.junit.quickcheck.generator.Generator.hasComponents()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中com.pholser.junit.quickcheck.generator.Generator.hasComponents()方法的一些代码示例,展示了Generator.hasComponents()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Generator.hasComponents()方法的具体详情如下:
包路径:com.pholser.junit.quickcheck.generator.Generator
类名称:Generator
方法名:hasComponents

Generator.hasComponents介绍

[英]This is intended for use only by junit-quickcheck itself, and not by creators of custom generators.
[中]这仅适用于junit quickcheck本身,而不适用于自定义生成器的创建者。

代码示例

代码示例来源:origin: pholser/junit-quickcheck

@Override
public boolean hasComponents() {
  return delegate.hasComponents();
}

代码示例来源:origin: pholser/junit-quickcheck

private void applyComponentGenerators(Generator<?> generator, List<Generator<?>> componentGenerators) {
  if (generator.hasComponents()) {
    if (componentGenerators.isEmpty()) {
      List<Generator<?>> substitutes = new ArrayList<>();
      Generator<?> zilch = generatorFor(
        new ParameterTypeContext(
          "Zilch",
          null,
          getClass().getName(),
          token(Zilch.class),
          emptyMap())
        .allowMixedTypes(true));
      for (int i = 0; i < generator.numberOfNeededComponents(); ++i)
        substitutes.add(zilch);
      generator.addComponentGenerators(substitutes);
    } else
      generator.addComponentGenerators(componentGenerators);
  }
}

代码示例来源:origin: pholser/junit-quickcheck

@Test public void noComponents() {
  assertFalse(generator.hasComponents());
}

代码示例来源:origin: pholser/junit-quickcheck

@Test public void noComponents() {
  assertFalse(generator.hasComponents());
}

代码示例来源:origin: com.pholser/junit-quickcheck-core

private void applyComponentGenerators(Generator<?> generator, List<Generator<?>> componentGenerators) {
  if (generator.hasComponents()) {
    if (componentGenerators.isEmpty()) {
      List<Generator<?>> substitutes = new ArrayList<>();
      Generator<?> zilch = generatorFor(
        new ParameterTypeContext(
          "Zilch",
          null,
          getClass().getName(),
          token(Zilch.class),
          emptyMap())
        .allowMixedTypes(true));
      for (int i = 0; i < generator.numberOfNeededComponents(); ++i)
        substitutes.add(zilch);
      generator.addComponentGenerators(substitutes);
    } else
      generator.addComponentGenerators(componentGenerators);
  }
}

相关文章