Skip to content

0.7.x manual 11.annotations

Hiroshi Ukai edited this page Jul 7, 2016 · 2 revisions

Background

As of now, JCUnit's annotation system became more complicated than it should be. Simplify this.

Design

In the following example, users should not need to write @GenerateCoveringArrayWith annotation every time because the setting is pretty typical. Let's make them (values set to checker and reporters) default of those attributes.

@RunWith(JCUnit.class)
@GenerateCoveringArrayWith(
    checker = @Checker(value = SmartConstraintChecker.class),
    reporters = {
        @Reporter(value = CombinatorialMetrics.class, args = { @Value("2") })
    })
public class QuadraticEquationSolverTest8 {
  @FactorField
  public int a;
  @FactorField
  public int b;
  @FactorField
  public int c;

  @Uses({ "a" })
  @Condition(constraint = true)
  public boolean aIsNonZero() {
    return this.a != 0;
  }

  ...

  @Test(expected = IllegalArgumentException.class)
  @When({ "!aIsNonZero" })
  public void solveEquation1$thenThrowIllegalArgumentException() {
    new QuadraticEquationSolver(
        a,
        b,
        c).solve();
  }

  ...

Usage

(t.b.d.)

References

Clone this wiki locally