/* * Copyright (C) 2016 The Android Open Source Project * * 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 or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package libcore.junit.junit3; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; import junit.framework.TestCase; import org.junit.Rule; import org.junit.rules.MethodRule; import org.junit.rules.TestRule; import org.junit.runner.Description; import org.junit.runners.model.FrameworkMethod; import org.junit.runners.model.MultipleFailureException; import org.junit.runners.model.Statement; import org.junit.runners.model.TestClass; import static org.junit.internal.runners.rules.RuleMemberValidator.RULE_VALIDATOR; /** * A {@link TestCase} that supports the @Rule annotation from JUnit 4. * *
It supports both {@link TestRule} and {@link MethodRule} based rules when used with the * {@code @Rule} annotation on public fields and methods. The rules encapsulate the * {@link TestCase#runBare()} method and so are run before the {@link TestCase#setUp()} and after * the {@link TestCase#tearDown()} methods. * *
Classes that extend this must have a single no argument constructor.
*/
public abstract class TestCaseWithRules extends TestCase {
private final TestClass testClass;
private final List