1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package vogar.target.junit.junit3; 18 19 import java.util.List; 20 import junit.framework.Test; 21 import junit.framework.TestCase; 22 import junit.framework.TestSuite; 23 import org.junit.runner.Description; 24 25 /** 26 * A factory for creating components of a test suite. 27 * 28 * @param <T> the base type of the 'test case', 'suite' and 'custom test' components 29 */ 30 public interface TestSuiteFactory<T> { 31 32 /** 33 * Create a representation of a {@link TestSuite}. 34 * 35 * @param name the name of the suite. 36 * @param children the transformed children of the test. 37 * @return the representation of the {@link TestSuite}. 38 */ createSuite(String name, List<T> children)39 T createSuite(String name, List<T> children); 40 41 /** 42 * Create a representation of the {@link TestCase}. 43 * 44 * @param testCase the test case. 45 * @param description the description of the test case. 46 * @return the representation of the {@link TestCase}. 47 */ createTestCase(TestCase testCase, Description description)48 T createTestCase(TestCase testCase, Description description); 49 50 /** 51 * Create a representation of a custom {@link Test}. 52 * 53 * @param test the test. 54 * @param description the description of the test case. 55 * @return the representation of the {@link Test}. 56 */ createCustomTest(Test test, Description description)57 T createCustomTest(Test test, Description description); 58 } 59