/*
 * Copyright 2013 the original author or authors.
 *
 * 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 org.gradle.api.tasks.testing;

import org.gradle.api.Incubating;

import java.util.Set;

/**
 * Allows filtering tests for execution. Some examples:
 *
 * <pre autoTested=''> apply plugin: 'java'
 *
 * test { filter { //specific test method includeTestsMatching "org.gradle.SomeTest.someSpecificFeature"
 *
 * //specific test method, use wildcard for packages includeTestsMatching "*SomeTest.someSpecificFeature"
 *
 * //specific test class includeTestsMatching "org.gradle.SomeTest"
 *
 * //specific test class, wildcard for packages includeTestsMatching "*.SomeTest"
 *
 * //all classes in package, recursively includeTestsMatching "com.gradle.tooling.*"
 *
 * //all integration tests, by naming convention includeTestsMatching "*IntegTest"
 *
 * //only ui tests from integration tests, by some naming convention includeTestsMatching "*IntegTest*ui" } }
 *
 * </pre>
 *
 * @since 1.10
 */
@Incubating
public interface TestFilter {

    /**
     * Appends a test name pattern to the filter. Wildcard '*' is supported, either test method name or class name is supported. Examples of test names: "com.foo.FooTest.someMethod",
     * "com.foo.FooTest", "*FooTest*", "com.foo*". See examples in the docs for {@link TestFilter}.
     *
     * @param testNamePattern test name pattern to include, can be class or method name, can contain wildcard '*'
     * @return this filter object
     */
    TestFilter includeTestsMatching(String testNamePattern);

    /**
     * Returns the included test name patterns. They can be class or method names and may contain wildcard '*'. Test name patterns can be appended via {@link #includeTestsMatching(String)} or set via
     * {@link #setIncludePatterns(String...)}.
     *
     * @return included test name patterns
     */
    Set<String> getIncludePatterns();

    /**
     * Sets the test name patterns to be included in the filter. Wildcard '*' is supported. Replaces any existing test name patterns.
     *
     * @param testNamePatterns class or method name patterns to set, may contain wildcard '*'
     * @return this filter object
     */
    TestFilter setIncludePatterns(String... testNamePatterns);

    TestFilter includeTest(String className, String methodName);
}


@@ -791,16 +791,21 @@
 sted=''%3E
+%0A *  
  apply p
@@ -827,24 +827,47 @@
 *%0A *
+  
  test %7B
- filter %7B
+%0A *       filter %7B%0A *         
  //s
@@ -885,16 +885,28 @@
 t method
+%0A *         
  include
@@ -958,32 +958,41 @@
 icFeature%22%0A *%0A *
+         
  //specific test
@@ -1017,32 +1017,44 @@
 ard for packages
+%0A *         
  includeTestsMat
@@ -1092,24 +1092,33 @@
 ature%22%0A *%0A *
+         
  //specific 
@@ -1127,16 +1127,28 @@
 st class
+%0A *         
  include
@@ -1188,16 +1188,25 @@
 t%22%0A *%0A *
+         
  //speci
@@ -1242,16 +1242,28 @@
 packages
+%0A *         
  include
@@ -1290,24 +1290,33 @@
 eTest%22%0A *%0A *
+         
  //all class
@@ -1341,16 +1341,28 @@
 ursively
+%0A *         
  include
@@ -1403,16 +1403,25 @@
 *%22%0A *%0A *
+         
  //all i
@@ -1450,32 +1450,44 @@
 aming convention
+%0A *         
  includeTestsMat
@@ -1510,16 +1510,25 @@
 t%22%0A *%0A *
+         
  //only 
@@ -1585,16 +1585,28 @@
 nvention
+%0A *         
  include
@@ -1634,18 +1634,149 @@
 Test*ui%22
+%0A *%0A *          //specific test class and test method%0A *          includeTest %22org.gradle.SomeTest%22, %22someTestMethod%22%0A *       %7D%0A * 
  
-%7D
  %7D%0A *%0A *
@@ -3061,24 +3061,355 @@
 Patterns);%0A%0A
+    /**%0A     * Sets the test name patterns to be included in the filter. Wildcard '*' is supported. Replaces any existing test name patterns.%0A     *%0A     * @param className the class name of the test to execute%0A     * @param methodName the method name of the test to execute. Can be null.%0A     * @return this filter object%0A     */%0A
     TestFilt

fix formatting of TestFilter example + some javadoc