001    // jademx - JADE management using JMX
002    // Copyright 2004-2005 Caboodle Networks, Inc.
003    //
004    // This library is free software; you can redistribute it and/or
005    // modify it under the terms of the GNU Lesser General Public
006    // License as published by the Free Software Foundation; either
007    // version 2.1 of the License, or (at your option) any later version.
008    //
009    // This library is distributed in the hope that it will be useful,
010    // but WITHOUT ANY WARRANTY; without even the implied warranty of
011    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012    // Lesser General Public License for more details.
013    //
014    // You should have received a copy of the GNU Lesser General Public
015    // License along with this library; if not, write to the Free Software
016    // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
017    
018    package jade.jademx.util;
019    
020    import jade.jademx.JadeMXSuiteTest;
021    import junit.framework.Test;
022    import junit.framework.TestCase;
023    import junit.framework.TestSuite;
024    
025    /**
026     * test jade.jademx.util.ThrowableUtil
027     * @author David Bernstein, <a href="http://www.caboodlenetworks.com"
028     *  >Caboodle Networks, Inc.</a>
029     */
030    public class ThrowableUtilTest extends TestCase {
031        
032        /**
033         * test getting stack trace as text and creating error message
034         */
035        public void testStackTraceAndErrMsg() {
036            Throwable t = new Throwable();
037            String st = ThrowableUtil.stackTrace( t );
038            final String FOO = "foo";
039            String em = ThrowableUtil.errMsg( FOO, t );
040            assertEquals( FOO + '\n' + st, em );
041        }
042        
043        // suite
044        
045        /**
046         * return the implicit suite of tests
047         * @return the implicit suite of tests
048         */
049        public static Test suite() {
050            return new TestSuite( 
051                    ThrowableUtilTest.class, 
052                    JadeMXSuiteTest.nameWithClass( ThrowableUtilTest.class, 
053                    "testing ThrowableUtil: utilities for Throwable") );
054        }
055        
056    
057    }