All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sft.SimpleFunctionalTest Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2013, 2014 Sylvain Lézier.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Sylvain Lézier - initial implementation
 *******************************************************************************/
package sft;


import org.junit.internal.AssumptionViolatedException;
import org.junit.internal.runners.model.EachTestNotifier;
import org.junit.runner.Description;
import org.junit.runner.Runner;
import org.junit.runner.notification.RunNotifier;
import org.junit.runner.notification.StoppedByUserException;
import sft.junit.JunitSftNotifier;
import sft.junit.SftNotifier;
import sft.junit.UseCaseRunner;
import sft.result.SftLogger;

public class SimpleFunctionalTest extends Runner {

    private static UseCaseRunner rootRunner;

    public SimpleFunctionalTest(Class klass) throws Exception {
        rootRunner = new UseCaseRunner(klass);
    }

    @Override
    public Description getDescription() {
        return rootRunner.getDescription();
    }

    @Override
    public void run(final RunNotifier notifier) {
        EachTestNotifier testNotifier = new EachTestNotifier(notifier, getDescription());
        try {
            rootRunner.run(new JunitSftNotifier(notifier));
        } catch (AssumptionViolatedException e) {
            testNotifier.fireTestIgnored();
        } catch (StoppedByUserException e) {
            throw e;
        } catch (Throwable e) {
            testNotifier.addFailure(e);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy