コード例 #1
0
  @Test
  public void testDetachMultistatusFromCoreException() {
    // #input
    // st4
    // -ex4
    // --cex
    // ---mst3
    // ----ex1
    // ----st1
    // -----ex2
    // ----st2
    // -----ex3
    Status st = st(ex(cex(mst(ex(), st(ex()), st(ex())))));
    // #expected output
    // st4
    // -ex4
    // --cex(mst3)
    // ---ex1
    // -mst3 (moved from cex to st4.children)
    // --ex1
    // --st1
    // ---ex2
    // --st2
    // ---ex3
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st4 =
        Reports.newStatus(st, configuration);
    Throwable ex4 = st4.getException();
    Throwable cex = ex4.getCause();
    Throwable ex1 = cex.getCause();
    org.eclipse.epp.internal.logging.aeri.ui.model.Status mst3 = st4.getChildren().get(0);
    Throwable ex1b = mst3.getException();
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st1 = mst3.getChildren().get(0);
    Throwable ex2 = st1.getException();
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st2 = mst3.getChildren().get(1);
    Throwable ex3 = st2.getException();

    assertThat(st4.getMessage(), is("st4"));
    assertThat(ex4.getMessage(), is("ex4"));
    assertThat(cex.getMessage(), is("mst3"));
    assertThat(ex1.getMessage(), is("ex1"));
    assertThat(
        mst3.getMessage(),
        is("mst3 [detached from CoreException of Status 'st4' by Error Reporting]"));
    assertThat(ex1b.getMessage(), is("ex1"));
    assertThat(st1.getMessage(), is("st1"));
    assertThat(ex2.getMessage(), is("ex2"));
    assertThat(st2.getMessage(), is("st2"));
    assertThat(ex3.getMessage(), is("ex3"));
  }
コード例 #2
0
  @Test
  public void testDetachMultipleMultistatusFromCoreException() {
    // #input
    // st9
    // -ex6
    // --cex
    // ---st8
    // ----cex
    // -----mst7
    // ------ex1
    // ------st4
    // -------cex
    // --------mst3
    // ---------ex2
    // ---------st1
    // ----------ex3
    // ---------st2
    // ----------ex4
    // ------st6
    // -------cex
    // --------st5
    // ---------ex5
    Status st =
        st(ex(cex(st(cex(mst(ex(), st(cex(mst(ex(), st(ex()), st(ex())))), st(cex(st(ex())))))))));
    // #expected output
    // st9
    // -st8
    // --mst7
    // ---ex1
    // ---st4
    // ----mst3
    // -----ex2
    // ----st1
    // -----ex3
    // ----st2
    // -----ex4
    // ---st6
    // ----st5
    // -----ex5
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st9 =
        Reports.newStatus(st, configuration);
    Throwable ex6 = st9.getException();
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st8 = st9.getChildren().get(0);
    org.eclipse.epp.internal.logging.aeri.ui.model.Status mst7 = st8.getChildren().get(0);
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st4 = mst7.getChildren().get(0);
    org.eclipse.epp.internal.logging.aeri.ui.model.Status mst3 = st4.getChildren().get(0);
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st2 = mst3.getChildren().get(1);
    Throwable ex4 = st2.getException();
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st6 = mst7.getChildren().get(1);
    org.eclipse.epp.internal.logging.aeri.ui.model.Status st5 = st6.getChildren().get(0);
    Throwable ex5 = st5.getException();

    assertThat(st9.getMessage(), is("st9"));
    assertThat(ex6.getMessage(), is("ex6"));
    assertThat(
        st8.getMessage(),
        is("st8 [detached from CoreException of Status 'st9' by Error Reporting]"));
    assertThat(
        mst7.getMessage(),
        is("mst7 [detached from CoreException of Status 'st8' by Error Reporting]"));
    assertThat(st4.getMessage(), is("st4"));
    assertThat(
        mst3.getMessage(),
        is("mst3 [detached from CoreException of Status 'st4' by Error Reporting]"));
    assertThat(st2.getMessage(), is("st2"));
    assertThat(ex4.getMessage(), is("ex4"));
    assertThat(st6.getMessage(), is("st6"));
    assertThat(
        st5.getMessage(),
        is("st5 [detached from CoreException of Status 'st6' by Error Reporting]"));
    assertThat(ex5.getMessage(), is("ex5"));
  }