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

Disabled test causes NullPointerException when using subclassable stage #376

Closed
wulfsberg opened this issue Dec 12, 2018 · 2 comments
Closed
Milestone

Comments

@wulfsberg
Copy link

JUnit 5.3.2, JGiven 0.17.0

Using the generics notation for a subclassable test Stage:

import com.tngtech.jgiven.Stage;

public class ExtensibleReproStage<SELF extends ExtensibleReproStage<SELF>> extends Stage<SELF> {
  public SELF something() {
    return self();
  }
}

When a test scenario uses this class and has a @disabled test, the following test will crash as given() returns null:

import com.tngtech.jgiven.junit5.SimpleScenarioTest;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;

public class ReproTest extends SimpleScenarioTest<ExtensibleReproStage> {
  @Test
  @Disabled
  void test1() {
    given().something();
  }
  
  @Test
  void test2() {
    // given() returns null when following test1
    given().something();
  }
}

This does not happen with a "normal", non-subclassable Stage

This is likely somewhat related to #338

@wulfsberg
Copy link
Author

In fact, I get a similar NullPointerException in a more complex test suite without using subclassable generics, but I cannot find a clear repro case for that situation.

@janschaefer
Copy link
Contributor

Thanks for the report. I could reproduce the issue and found the problem.

janschaefer added a commit that referenced this issue Jan 20, 2019
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