Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-2405

Suppressed Exceptions are not visible to users (Junit 5)

Log workAgile BoardRank to TopRank to BottomAttach filesAttach ScreenshotBulk Copy AttachmentsBulk Move AttachmentsAdd voteVotersWatch issueWatchersCreate sub-taskConvert to sub-taskLinkCloneLabelsUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 10.0
    • None
    • java - JUnit
    • win 10, x64, open jdk 11.0.2

    Description

      Suppressed Exceptions are not visible to users in the "Test Results" window and the console. Junit 5 is using this to report several exceptions in one test (see org.junit.platform.engine.support.hierarchical.ThrowableCollector#add)

      Console-Output:

       

      doSomething  Time elapsed: 0.016 s  <<< ERROR!
      java.lang.IllegalStateException: the exception
       at com.company.DummyTest.doSomething(DummyTest.java:25)
      Caused by: java.lang.IllegalStateException: the cause
       at com.company.DummyTest.doSomething(DummyTest.java:25)
      

      Code to reproduce:

       

              @org.junit.jupiter.api.Test
              public void doSomething() {
                  IllegalStateException dummy = new IllegalStateException(
                          "the exception", new IllegalStateException("the cause")
                  );
                  
                  dummy.addSuppressed(new IllegalStateException("the suppressed"));
                  throw dummy;
              }
      

       

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned Assign to me
            joerg1985 Jörg Sautter

            Dates

              Created:
              Updated:

              Slack

                Issue deployment