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

Suppressed Exceptions are not visible to users (Junit 5)

    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

          People

            Unassigned Unassigned
            joerg1985 Jörg Sautter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: