diff --git a/spring-boot-dependencies/pom.xml b/spring-boot-dependencies/pom.xml
index db08e3750335..22d5cef2483b 100644
--- a/spring-boot-dependencies/pom.xml
+++ b/spring-boot-dependencies/pom.xml
@@ -174,6 +174,7 @@
3.8.11.2
3.1.0
${javax-mail.version}
+ 6.10
2.1.5.RELEASE
2.1.2.RELEASE
2.1.2.RELEASE
@@ -2343,6 +2344,11 @@
sqlite-jdbc
${sqlite-jdbc.version}
+
+ org.testng
+ testng
+ ${testng.version}
+
org.thymeleaf
thymeleaf
diff --git a/spring-boot-test/pom.xml b/spring-boot-test/pom.xml
index 91dbc4b8602c..bbda542517e1 100644
--- a/spring-boot-test/pom.xml
+++ b/spring-boot-test/pom.xml
@@ -154,6 +154,11 @@
spring-webmvc
test
+
+ org.testng
+ testng
+ test
+
diff --git a/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java b/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java
index 803436ca7323..4f73a2e10d0b 100644
--- a/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java
+++ b/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java
@@ -31,9 +31,9 @@
*/
class TestTypeExcludeFilter extends TypeExcludeFilter {
- private static final String[] CLASS_ANNOTATIONS = { "org.junit.runner.RunWith" };
+ private static final String[] CLASS_ANNOTATIONS = { "org.junit.runner.RunWith", "org.testng.annotations.Test" };
- private static final String[] METHOD_ANNOTATIONS = { "org.junit.Test" };
+ private static final String[] METHOD_ANNOTATIONS = { "org.junit.Test", "org.testng.annotations.Test" };
@Override
public boolean match(MetadataReader metadataReader,
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/AbstractTestNG.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/AbstractTestNG.java
new file mode 100644
index 000000000000..7349825ae43e
--- /dev/null
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/AbstractTestNG.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2012-2016 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.springframework.boot.test.context.filter;
+
+import org.testng.annotations.Test;
+
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * Abstract test with nest {@code @Configuration} and {@code @Test} used by
+ * {@link TestTypeExcludeFilter}.
+ *
+ * @author EddĂș MelĂ©ndez
+ */
+@Test
+public abstract class AbstractTestNG {
+
+ @Configuration
+ static class Config {
+
+ }
+
+}
diff --git a/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java b/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java
index 38e555e5841d..9adeaf0b4d14 100644
--- a/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java
+++ b/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java
@@ -70,6 +70,13 @@ public void doesNotMatchRegularConfiguration() throws Exception {
this.metadataReaderFactory)).isFalse();
}
+ @Test
+ public void matchesNestedConfigurationClassWithoutTestngAnnotation()
+ throws Exception {
+ assertThat(this.filter.match(getMetadataReader(AbstractTestNG.Config.class),
+ this.metadataReaderFactory)).isTrue();
+ }
+
private MetadataReader getMetadataReader(Class> source) throws IOException {
return this.metadataReaderFactory.getMetadataReader(source.getName());
}