001 package org.hackystat.utilities.stacktrace; 002 003 import static org.junit.Assert.assertTrue; 004 005 import org.junit.Test; 006 007 /** 008 * Tests the Stack Trace class. 009 * @author Philip Johnson 010 */ 011 public class TestStackTrace { 012 013 /** 014 * Tests the Stack Tracing. 015 * Generates an exception, makes the Stack Trace, and checks to see if it seems OK. 016 */ 017 @Test public void testStackTrace () { 018 String trace; 019 try { 020 throw new Exception("Test Exception"); 021 } 022 catch (Exception e) { 023 trace = StackTrace.toString(e); 024 } 025 assertTrue("Check trace", trace.startsWith("java.lang.Exception")); 026 } 027 028 }