001/******************************************************************************* 002 * Copyright (c) 2006-2014 Nuxeo SA (http://nuxeo.com/) and others. 003 * 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 ******************************************************************************/ 009package org.nuxeo.runtime.test.runner; 010 011import org.junit.runner.Runner; 012import org.junit.runners.Suite; 013import org.junit.runners.model.InitializationError; 014import org.junit.runners.model.RunnerBuilder; 015 016public class ContributableFeaturesRunner extends Suite { 017 018 public ContributableFeaturesRunner(final Class<?> clazz, final RunnerBuilder builder) throws InitializationError { 019 super(clazz, new RunnerBuilder() { 020 021 @Override 022 public Runner runnerForClass(Class<?> testClass) throws Throwable { 023 Runner runner = builder.runnerForClass(testClass); 024 if (runner instanceof FeaturesRunner) { 025 ((FeaturesRunner) runner).loader.loadFeatures(clazz); 026 } 027 return runner; 028 } 029 030 }); 031 } 032 033}