JBehave
  1. JBehave
  2. JBEHAVE-1068

NullPointerException with JUnit 4.12

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.9.5
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      When using JUnit 4.12 a problem appears when JBehave is trying to build the reporting :

      java.lang.RuntimeException: java.lang.NullPointerException
      at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.run(JUnitReportingRunner.java:80)
      at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
      at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
      at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
      Caused by: java.lang.NullPointerException
      at de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.afterStory(JUnitScenarioReporter.java:114)
      at org.jbehave.core.reporters.DelegatingStoryReporter.afterStory(DelegatingStoryReporter.java:49)
      at org.jbehave.core.reporters.ConcurrentStoryReporter.afterStory(ConcurrentStoryReporter.java:120)
      at org.jbehave.core.embedder.PerformableTree.performBeforeOrAfterStories(PerformableTree.java:399)
      at org.jbehave.core.embedder.StoryManager.performStories(StoryManager.java:102)
      at org.jbehave.core.embedder.StoryManager.runStories(StoryManager.java:93)
      at org.jbehave.core.embedder.StoryManager.runStoriesAsPaths(StoryManager.java:74)
      at org.jbehave.core.embedder.Embedder.runStoriesAsPaths(Embedder.java:204)
      at de.codecentric.jbehave.junit.monitoring.JUnitReportingRunner.run(JUnitReportingRunner.java:78)
      ... 6 more

      The nullpointer is caused by following line:

      JunitReportingRunner:171

      private void initRootDescription()

      Unknown macro: { rootDescription = Description .createSuiteDescription(configurableEmbedder.getClass()); rootDescription.getChildren().addAll(storyDescriptions); }

      rootDescription.getChildren returns a new array list of children, so doing addAll does not actually add the children to the actual list of Description
      Description class does offer a method addChild, using this method would solve this issue

        Activity

        Hide
        Matthieu Mestrez added a comment -
        Show
        Matthieu Mestrez added a comment - This StackOverFlow post describes the problem as well http://stackoverflow.com/questions/25589963/jbehave-junit-runner-throwing-nullpointerexception
        Hide
        Cristiano Gavião added a comment - - edited

        the error is in the de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.afterStory(JUnitScenarioReporter.java:114) no?

        So, I don't think it is not related to jbehave project but codecentric's code.

        Show
        Cristiano Gavião added a comment - - edited the error is in the de.codecentric.jbehave.junit.monitoring.JUnitScenarioReporter.afterStory(JUnitScenarioReporter.java:114) no? So, I don't think it is not related to jbehave project but codecentric's code.

          People

          • Assignee:
            Unassigned
            Reporter:
            Matthieu Mestrez
          • Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated: