patterntesting.concurrent.junit.JUnit3Executor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of patterntesting-concurrent Show documentation
Show all versions of patterntesting-concurrent Show documentation
PatternTesting Concurrent (patterntesting-concurrent) is a collection
of useful thread aspects. It has support for testing, for
sychnronization and for concurrent programming.
Some of the ideas used in this library comes from reading
Brian Goetz's book "Java Concurrency in Practice".
/*
* $Id: JUnit3Executor.java,v 1.7 2010/07/21 16:29:45 oboehm Exp $
*
* Copyright (c) 2009 by Oliver Boehm
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express orimplied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* (c)reated 18.12.2009 by oliver ([email protected])
*/
package patterntesting.concurrent.junit;
import java.util.List;
import org.junit.runners.model.FrameworkMethod;
import patterntesting.runtime.junit.internal.JUnitHelper;
/**
* This class is responsible for starting a JUnit3 test method.
* It is responsible for the setup for JUnit 3. The rest is done by
* the super class.
*
* @author oliver
* @since 18.12.2009
*/
public class JUnit3Executor extends JUnitExecutor {
/**
* @param clazz the class with the test methods (JUnit 4)
*/
public JUnit3Executor(final Class> clazz) {
super(clazz);
recordResults();
}
@Override
protected final void recordResults() {
this.setupMethods();
if (this.isRunParallelEnabled()) {
this.recordTestMethods();
}
}
/**
* Here we look after public void methods with "test" as prefix and with no
* arguments. We look here also for the setUp and tearDown method.
*/
private void setupMethods() {
List testMethods = ParallelRunner
.getJUnit3TestMethods(this.getTestClass());
for (FrameworkMethod fwkMethod : testMethods) {
results.put(fwkMethod.getName(), new Result(fwkMethod.getMethod()));
}
FrameworkMethod setUp = JUnitHelper.getFrameworkMethod(this
.getTestClass(), "setUp");
if (setUp != null) {
this.setupMethod = setUp.getMethod();
}
FrameworkMethod tearDown = JUnitHelper.getFrameworkMethod(this
.getTestClass(), "tearDown");
if (tearDown != null) {
this.teardownMethod = tearDown.getMethod();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy