Methods Summary |
---|
public java.util.List | _testStandardThrowables(java.util.List items)
final List<Throwable> results = new ArrayList<Throwable>();
for( final Throwable item : items )
{
results.addAll( _testStandardWrappedWithStandard( item ) );
}
return results;
|
private java.util.List | _testStandardWrappedWithStandard(java.lang.Throwable cause)
final List<Throwable> items = new ArrayList<Throwable>();
final Throwable t = new Throwable( "hello", cause);
assert( t == ThrowableMapper.map(t) );
items.add( t );
final Exception e = new Exception( "hello", cause);
assert( e == ThrowableMapper.map(e) );
items.add( e );
final RuntimeException r = new RuntimeException( "hello", cause);
assert( r == ThrowableMapper.map(r) );
items.add( r );
final IOException i = new IOException( "hello" );
i.initCause( cause );
assert( i == ThrowableMapper.map(i) );
items.add( i );
final Error err = new Error( "hello", cause);
assert( err == ThrowableMapper.map(err) );
items.add( err );
return items;
|
private java.util.List | getProprietary()
final List<Throwable> items = new ArrayList<Throwable>();
items.add( new ProprietaryThrowable( "ProprietaryThrowable test" ) );
items.add( new ProprietaryException( "ProprietaryException test" ) );
items.add( new ProprietaryRuntimeException( "ProprietaryRuntimeException test" ) );
items.add( new ProprietaryError( "ProprietaryError test" ) );
return items;
|
private java.util.List | getStandard()
final List<Throwable> items = new ArrayList<Throwable>();
items.add( new Throwable( "Throwable test" ) );
items.add( new Exception( "Exception test" ) );
items.add( new RuntimeException( "RuntimeException test" ) );
items.add( new IOException( "IOException test" ) );
items.add( new Error( "Error test" ) );
items.add( new MBeanException(
new Exception("within MBeanException"), "MBeanException test") );
items.add( new AttributeNotFoundException( "Test") );
items.add( new InstanceNotFoundException("InstanceNotFoundException test ") );
items.add( new ClassNotFoundException( "foo.bar") );
return items;
|
public void | testProprietary()
final List<Throwable> items = getProprietary();
for( final Throwable item : items )
{
final Throwable remapped = ThrowableMapper.map( item );
verifyMapping( item, remapped );
}
|
public void | testStandard()
final List<Throwable> items = _testStandardThrowables( getStandard() );
_testStandardThrowables( items );
|
private void | verifyMapping(java.lang.Throwable original, java.lang.Throwable remapped)
assert( remapped != original );
assert( remapped.getClass() != original.getClass() );
if ( original instanceof RuntimeException )
{
assert( remapped instanceof RuntimeException );
}
if ( original instanceof Error )
{
assert( remapped instanceof Error );
}
if ( original instanceof Exception )
{
assert( remapped instanceof Exception );
}
assert( original.getMessage().equals( remapped.getMessage() ) );
assert( ExceptionUtil.getCauses(original).length ==
ExceptionUtil.getCauses(remapped).length );
if ( original.getCause() != null )
{
verifyMapping( original.getCause(), remapped.getCause() );
}
final StackTraceElement[] originalStackTrace = original.getStackTrace();
final StackTraceElement[] remappedStackTrace = remapped.getStackTrace();
assert( originalStackTrace.length == remappedStackTrace.length );
for( int i = 0; i < originalStackTrace.length; ++i )
{
assert( originalStackTrace[i] == remappedStackTrace[ i ] );
}
|
public void | xxtestProprietary()
final Throwable t = new ProprietaryThrowable( "hello" );
final Throwable rm = ThrowableMapper.map( t );
final StackTraceElement[] originalStackTrace = t.getStackTrace();
final StackTraceElement[] remappedStackTrace = rm.getStackTrace();
assert( originalStackTrace.length == remappedStackTrace.length );
for( int i = 0; i < originalStackTrace.length; ++i )
{
assert( originalStackTrace[i] == remappedStackTrace[ i ] );
}
|