javacommons/utils/tsrc/javasrc/com/nokia/mj/impl/utils/DebugUtilsTests.java
changeset 79 2f468c1958d0
parent 76 4ad59aaee882
equal deleted inserted replaced
76:4ad59aaee882 79:2f468c1958d0
    68 
    68 
    69     public void testStackTrace()
    69     public void testStackTrace()
    70     {
    70     {
    71         try
    71         try
    72         {
    72         {
    73             try
    73             String res = DebugUtils.getStackTrace(null);
    74             {
    74             assertTrue("Not null: " + res, res == null);
    75                 DebugUtils.getStackTrace(null);
       
    76                 assertTrue("No exception.", false);
       
    77             }
       
    78             catch (NullPointerException ne)
       
    79             {
       
    80             }
       
    81 
    75 
    82             Exception e1 = new Exception("Test 42");
    76             Exception e1 = new Exception("Test 42");
    83             String res = DebugUtils.getStackTrace(e1);
    77             res = DebugUtils.getStackTrace(e1);
    84             boolean ok = res.indexOf("at com.nokia.mj.impl.utils.DebugUtilsTests.testStackTrace") >= 0;
    78             boolean ok = res.indexOf("at com.nokia.mj.impl.utils.DebugUtilsTests.testStackTrace") >= 0;
    85             assertTrue("Exception didn't contain: " + res, ok);
    79             assertTrue("Exception didn't contain: " + res, ok);
    86 
    80 
    87         }
    81         }
    88         catch (Throwable t)
    82         catch (Throwable t)
    89         {
    83         {
       
    84             t.printStackTrace();
    90             assertTrue(t.toString(), false);
    85             assertTrue(t.toString(), false);
    91             t.printStackTrace();
       
    92         }
    86         }
    93     }
    87     }
    94 }
    88 }