Skip to content

@FromDataPoints("misspelled") EnumType shouldn't test all enum values #1648

Closed as not planned
@awturner

Description

@awturner
@RunWith(Theories.class)
public class NonExistentTheory {
  @DataPoints("foo")
  public static final ImmutableSet<MetaSyntacticVariable> FOOS =
      ImmutableSet.of(MetaSyntacticVariable.FOO);

  @Theory
  public void doWithTheFoo(@FromDataPoints("bar") MetaSyntacticVariable whatever) {
    System.err.println(whatever);
  }

  @Theory
  public void doWithTheBoolean(@FromDataPoints("bar") boolean whatever) {
    System.err.println(whatever);
  }

  enum MetaSyntacticVariable {
    FOO, BAR, BAZ
  }
}

It is surprising that these @FromDataPoints-annotated parameters receive the same values as if the annotation were omitted. This means that typos in data point names aren't flagged as errors.

If the @FromDataPoints is present, and nothing matches, it would be helpful to raise "Never found parameters that satisfied method assumptions.".

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions