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

given() returns null if all @Test methods in previous class are @Disabled #338

Closed
wulfsberg opened this issue Feb 21, 2018 · 0 comments
Closed
Milestone

Comments

@wulfsberg
Copy link

Using jgiven-junit5, 0.15.3

Given two test classes implementing ScenarioTest or SimpleScenarioTest:

  • Class A has all @Test methods @Disabled.
  • Class B contains "normal" @Test methods.

When class B is run after class A in the same test run (say, using Maven), the given() call in class B returns null.

This only occurs if A has @Test methods which are all @Disabled.

E.g.

public class DisabledReproA extends ScenarioTest<ReproStage, ReproStage, ReproStage> {
  @Test
  @Disabled("for reasons")
  void testA() {
    given().something_is_set_up();
  }
}

public class DisabledReproB extends ScenarioTest<ReproStage, ReproStage, ReproStage> {
  @Test
  void testB() {
    // This will crash with a nullpointer exception:
    given().something_is_set_up();
  }
}

public class ReproStage extends Stage<ReproStage> {
  public ReproStage something_is_set_up() {
    return self();
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants