patterntesting.runtime.util
Class ExceptionThrower

Package class diagram package ExceptionThrower
java.lang.Object
  extended by patterntesting.runtime.util.ExceptionThrower

public final class ExceptionThrower
extends Object

Because we need the functionality of throwing any exception not only in PatternTesting Exception but also here this functionality was shifted to PatternTesting Runtime.
This class is not intended for public use. If you do so use it on your own risk!

Since:
1.0 (30.01.2010)
Author:
oliver

Method Summary
static Throwable create(Class<? extends Throwable> type)
          Creates any desired exception you want.
static void provoke(Class<? extends Throwable> type)
          Be careful - you can provoke any Exception with the method without the need to declare it with a throws statement.
static void provoke(org.junit.Test test)
          This method throws the expected exception wrapped into the Test annotation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

provoke

public static void provoke(Class<? extends Throwable> type)
Be careful - you can provoke any Exception with the method without the need to declare it with a throws statement. For example
provoke(IOException.class)
would throw an IOException.
WARNING: If the desired exception can't be instantiated an InstantiationException or IllegalAccessException may be thrown.
WARNING(2): This method is not synchronized.

Parameters:
type - e.g. IOException.class

provoke

public static void provoke(org.junit.Test test)
This method throws the expected exception wrapped into the Test annotation.

Parameters:
test - with the expected exception

create

public static Throwable create(Class<? extends Throwable> type)
                        throws InstantiationException,
                               IllegalAccessException
Creates any desired exception you want. If the desired exception can't be instantiated an InstantiationException or IllegalAccessException may be thrown.

Parameters:
type - the exception class you want to be created
Returns:
the instantiated exception or the caught exception
Throws:
IllegalAccessException - the illegal access exception
InstantiationException - the instantiation exception


Copyright © 2002–2014 PatternTesting Team. All rights reserved.