报告使用 @DataPoint 注解并且为非 public 和/或非 static 的字段或方法。 不能运行 @DataPoint 成员格式错误的 theories 测试类。

示例:


  @RunWith(Theories.class)
  public class SeriousTest {
    @DataPoint
    private String dataPoint = "value";

    @DataPoint("generated")
    private String generatedDataPoint() {
      return "generated value";
    }

    @Theory
    public void theoryMethod(String param) {
      // ...
    }
  }

通过快速修复来修正修饰符:


  @RunWith(Theories.class)
  public class SeriousTest {
    @DataPoint
    public static String dataPoint = "value";

    @DataPoint("generated")
    public static String generatedDataPoint() {
      return "generated value";
    }

    @Theory
    public void theoryMethod(String param) {
      // ...
    }
  }