Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow non-static Cartesian factory methods with PER_CLASS lifecycle #628

Merged
merged 3 commits into from May 25, 2022
Merged

Allow non-static Cartesian factory methods with PER_CLASS lifecycle #628

merged 3 commits into from May 25, 2022

Commits on May 25, 2022

  1. Allow non-static Cartesian factory methods with PER_CLASS lifecycle

    JUnit allows non-static factory methods as long as the test class is
    annotated with @testinstance(Lifecycle.PER_CLASS). The same is
    currently not true for @CartesianTest.MethodFactory. This commit
    fixes that.
    
    The existing non-static test is unmodified, indicating that
    non-static is still not allowed if the test class is not annotated
    with @testinstance(Lifecycle.PER_CLASS).
    
    PR: #628
    robtimus committed May 25, 2022
    Configuration menu
    Copy the full SHA
    6164e95 View commit details
    Browse the repository at this point in the history
  2. Improved requiredness check for static factory methods (628)

    When allowing non-static factory methods in combination with
    @testinstance(Lifecycle.PER_CLASS), there would be failures if the
    factory method was defined in a different class. The factory method
    now must also be static if it's not defined in the test class (or a
    super class of the test class).
    
    Also added an example on how to use @CartesianTest.MethodFactory in
    a nested test class.
    
    PR: #628
    robtimus committed May 25, 2022
    Configuration menu
    Copy the full SHA
    be9f231 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    1e85ec7 View commit details
    Browse the repository at this point in the history