Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package org.jboss.fuse.qa.runner;
- import org.junit.runner.Description;
- import org.junit.runner.Runner;
- import org.junit.runner.notification.RunNotifier;
- import java.lang.reflect.Constructor;
- import lombok.Getter;
- public class DynamicRunner extends Runner {
- @Getter
- protected Runner runner;
- public DynamicRunner(Class<?> clazz) throws Exception {
- runner = getRunnerByProperty(clazz);
- }
- @Override
- public Description getDescription() {
- return runner.getDescription();
- }
- @Override
- public void run(RunNotifier notifier) {
- runner.run(notifier);
- }
- private Runner getRunnerByProperty(Class<?> testClass) throws Exception {
- Class<?> realClass = Class.forName(System.getProperty("arq.runner.class"));
- Constructor<?> constructor = realClass.getConstructor(Class.class);
- return (Runner) constructor.newInstance(new Object[] {testClass});
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement