Package de.susebox.java.lang

Examples of de.susebox.java.lang.ThrowableList


    String                    msg       = "This is an illegal argument.";
    IllegalArgumentException  argEx     = new IllegalArgumentException(msg);
   
    // construct the exception to test
    Constructor   constr  = Class.forName(_classToTest).getConstructor(paraTypes);
    ThrowableList ex      = (ThrowableList)constr.newInstance(new Object[] { argEx } );

    // do the checks
    assertTrue("rtEx: Wrapper exception not recognized.", ex.isWrapper());
    assertTrue("rtEx: Didn't retrieve the wrapped exception.", ex.getCause() == argEx);
    assertTrue("rtEx: Messages not equal.", ((Exception)ex).getMessage().equals(argEx.getMessage()));
  }
View Full Code Here


    IllegalArgumentException  argEx     = new IllegalArgumentException(msg);
    Class[]                   paraTypes = new Class[] { new Throwable().getClass(), msg.getClass(), objArray.getClass() };
   
    // construct the exception to test
    Constructor   constr  = Class.forName(_classToTest).getConstructor(paraTypes);
    ThrowableList ex1     = (ThrowableList)constr.newInstance(new Object[] { argEx, format, new Object[] { new Integer(1), _classToTest } } );
    ThrowableList ex2     = (ThrowableList)constr.newInstance(new Object[] { ex1,   format, new Object[] { new Integer(2), _classToTest } } );

    // do the checks
    assertTrue("ex1: False wrapper exception.", ! ex1.isWrapper());
    assertTrue("ex2: False wrapper exception.", ! ex2.isWrapper());
    assertTrue("ex1: Didn't retrieve the nested exception.", ex1.getCause() == argEx);
    assertTrue("ex2: Didn't retrieve the first nested exception.", ex2.getCause() == ex1);
    assertTrue("ex2: Didn't retrieve the second nested exception.", ((ThrowableList)ex2.getCause()).getCause() == argEx);
    assertTrue("ex1: Format not found.", ex1.getFormat() == format);
    assertTrue("ex2: Format not found.", ex2.getFormat() == format);
  }
View Full Code Here

    Object[]  paras     = new Object[] { _classToTest, "bad weather", "myself" };
    Class[]   paraTypes = new Class[] { format.getClass(), paras.getClass() };
   
    // construct the exception to test
    Constructor   constr  = Class.forName(_classToTest).getConstructor(paraTypes);
    ThrowableList ex      = (ThrowableList)constr.newInstance(new Object[] { format, paras } );

    // do the checks
    assertTrue("Format not found.", ex.getFormat() == format);
   
    String str1 = MessageFormat.format(format, paras);
    String str2 = ((Exception)ex).getMessage();
    assertTrue("Formating failed. Expected \"" + str1 + "\", got \"" + str2 + "\".",
              str1.equals(str2));
View Full Code Here

TOP

Related Classes of de.susebox.java.lang.ThrowableList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.