Package org.jboss.byteman.contrib.bmunit
Class BMUnitRunner
- java.lang.Object
-
- org.junit.runner.Runner
-
- org.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
- org.junit.runners.BlockJUnit4ClassRunner
-
- org.jboss.byteman.contrib.bmunit.BMUnitRunner
-
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Orderable
,org.junit.runner.manipulation.Sortable
public class BMUnitRunner extends org.junit.runners.BlockJUnit4ClassRunner
Specialisation of the BlockJUnit4ClassRunner Runner class which can be attached to a text class using the @RunWith annotation. It ensures that Byteman rules are loaded and unloaded for tests which are annotated with an @Byteman annotation
-
-
Field Summary
Fields Modifier and Type Field Description private BMRunnerUtil
BMRunnerUtil
private BMUnitConfig
classConfigAnnotation
(package private) BMRules
classMultiRuleAnnotation
(package private) BMScripts
classMultiScriptAnnotation
(package private) BMRule
classSingleRuleAnnotation
(package private) BMScript
classSingleScriptAnnotation
(package private) java.lang.Class<?>
testKlazz
-
Constructor Summary
Constructors Constructor Description BMUnitRunner(java.lang.Class<?> klass)
Creates a BMUnitRunner to run test inklass
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.junit.runners.model.Statement
addClassConfigLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
protected org.junit.runners.model.Statement
addClassMultiRuleLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
protected org.junit.runners.model.Statement
addClassMultiScriptLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
protected org.junit.runners.model.Statement
addClassSingleRuleLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
protected org.junit.runners.model.Statement
addClassSingleScriptLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
protected org.junit.runners.model.Statement
addMethodConfigLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
protected org.junit.runners.model.Statement
addMethodMultiRuleLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMRules annotationprotected org.junit.runners.model.Statement
addMethodMultiScriptLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMScripts annotationprotected org.junit.runners.model.Statement
addMethodSingleRuleLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMRule annotationprotected org.junit.runners.model.Statement
addMethodSingleScriptLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMScript annotationprotected org.junit.runners.model.Statement
childrenInvoker(org.junit.runner.notification.RunNotifier notifier)
protected org.junit.runners.model.Statement
methodInvoker(org.junit.runners.model.FrameworkMethod method, java.lang.Object test)
-
Methods inherited from class org.junit.runners.BlockJUnit4ClassRunner
collectInitializationErrors, computeTestMethods, createTest, createTest, describeChild, getChildren, getTestRules, isIgnored, methodBlock, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeout
-
Methods inherited from class org.junit.runners.ParentRunner
classBlock, classRules, createTestClass, filter, getDescription, getName, getRunnerAnnotations, getTestClass, order, run, runLeaf, setScheduler, sort, validatePublicVoidNoArgMethods, withAfterClasses, withBeforeClasses, withInterruptIsolation
-
-
-
-
Field Detail
-
classConfigAnnotation
private BMUnitConfig classConfigAnnotation
-
classSingleScriptAnnotation
BMScript classSingleScriptAnnotation
-
classMultiScriptAnnotation
BMScripts classMultiScriptAnnotation
-
classMultiRuleAnnotation
BMRules classMultiRuleAnnotation
-
classSingleRuleAnnotation
BMRule classSingleRuleAnnotation
-
testKlazz
java.lang.Class<?> testKlazz
-
BMRunnerUtil
private final BMRunnerUtil BMRunnerUtil
-
-
Constructor Detail
-
BMUnitRunner
public BMUnitRunner(java.lang.Class<?> klass) throws org.junit.runners.model.InitializationError
Creates a BMUnitRunner to run test inklass
- Parameters:
klass
- idenitifies the Java class containing the tests- Throws:
org.junit.runners.model.InitializationError
- if the test class is malformed.
-
-
Method Detail
-
childrenInvoker
protected org.junit.runners.model.Statement childrenInvoker(org.junit.runner.notification.RunNotifier notifier)
- Overrides:
childrenInvoker
in classorg.junit.runners.ParentRunner<org.junit.runners.model.FrameworkMethod>
-
addClassConfigLoader
protected org.junit.runners.model.Statement addClassConfigLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
-
addClassSingleScriptLoader
protected org.junit.runners.model.Statement addClassSingleScriptLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
-
addClassMultiScriptLoader
protected org.junit.runners.model.Statement addClassMultiScriptLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
-
addClassMultiRuleLoader
protected org.junit.runners.model.Statement addClassMultiRuleLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
-
addClassSingleRuleLoader
protected org.junit.runners.model.Statement addClassSingleRuleLoader(org.junit.runners.model.Statement statement, org.junit.runner.notification.RunNotifier notifier)
-
methodInvoker
protected org.junit.runners.model.Statement methodInvoker(org.junit.runners.model.FrameworkMethod method, java.lang.Object test)
- Overrides:
methodInvoker
in classorg.junit.runners.BlockJUnit4ClassRunner
-
addMethodConfigLoader
protected org.junit.runners.model.Statement addMethodConfigLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
-
addMethodSingleScriptLoader
protected org.junit.runners.model.Statement addMethodSingleScriptLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMScript annotation- Parameters:
statement
- the statement to be evaluatedmethod
- the method being tested- Returns:
- the statement possibly wrapped with load and unload calls
-
addMethodMultiScriptLoader
protected org.junit.runners.model.Statement addMethodMultiScriptLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMScripts annotation- Parameters:
statement
- the statement to be evaluatedmethod
- the method being tested- Returns:
- the statement possibly wrapped with load and unload calls
-
addMethodMultiRuleLoader
protected org.junit.runners.model.Statement addMethodMultiRuleLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMRules annotation- Parameters:
statement
- the statement to be evaluatedmethod
- the method being tested- Returns:
- the statement possibly wrapped with load and unload calls
-
addMethodSingleRuleLoader
protected org.junit.runners.model.Statement addMethodSingleRuleLoader(org.junit.runners.model.Statement statement, org.junit.runners.model.FrameworkMethod method)
wrap the test method execution statement with the necessary load and unload calls if it has a BMRule annotation- Parameters:
statement
- the statement to be evaluatedmethod
- the method being tested- Returns:
- the statement possibly wrapped with load and unload calls
-
-