Package patterntesting.runtime.util
Class ExceptionThrower
- java.lang.Object
-
- patterntesting.runtime.util.ExceptionThrower
-
public final class ExceptionThrower extends java.lang.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
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.Throwable
create(java.lang.Class<? extends java.lang.Throwable> type)
Creates any desired exception you want.static void
provoke(java.lang.Class<? extends java.lang.Throwable> type)
Be careful - you can provoke any Exception with the method without the need to declare it with a throws statement.
-
-
-
Method Detail
-
provoke
public static void provoke(java.lang.Class<? extends java.lang.Throwable> type)
Be careful - you can provoke any Exception with the method without the need to declare it with a throws statement. For exampleprovoke(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
-
create
public static java.lang.Throwable create(java.lang.Class<? extends java.lang.Throwable> type) throws java.lang.ReflectiveOperationException
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:
java.lang.ReflectiveOperationException
- the reflective operation exception
-
-