diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml
index 7026be1e7760..eee384fc3816 100644
--- a/spring-boot-project/spring-boot-dependencies/pom.xml
+++ b/spring-boot-project/spring-boot-dependencies/pom.xml
@@ -182,6 +182,7 @@
3.1.0
${javax-mail.version}
1.5.0
+ 6.10
3.0.11.RELEASE
3.0.4.RELEASE
2.3.0
@@ -2965,6 +2966,11 @@
nio-multipart-parser
${nio-multipart-parser.version}
+
+ org.testng
+ testng
+ ${testng.version}
+
org.thymeleaf
thymeleaf
diff --git a/spring-boot-project/spring-boot-test/pom.xml b/spring-boot-project/spring-boot-test/pom.xml
index 0c4901912872..1e25028b4983 100644
--- a/spring-boot-project/spring-boot-test/pom.xml
+++ b/spring-boot-project/spring-boot-test/pom.xml
@@ -192,6 +192,11 @@
mockito-kotlin
test
+
+ org.testng
+ testng
+ test
+
diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java
index 9747d041d331..4f1efe67b5a0 100644
--- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java
+++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2018 the original author or authors.
+ * Copyright 2012-2019 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.
@@ -33,10 +33,11 @@
class TestTypeExcludeFilter extends TypeExcludeFilter {
private static final String[] CLASS_ANNOTATIONS = { "org.junit.runner.RunWith",
- "org.junit.jupiter.api.extension.ExtendWith" };
+ "org.junit.jupiter.api.extension.ExtendWith", "org.testng.annotations.Test" };
private static final String[] METHOD_ANNOTATIONS = { "org.junit.Test",
- "org.junit.platform.commons.annotation.Testable" };
+ "org.junit.platform.commons.annotation.Testable",
+ "org.testng.annotations.Test" };
@Override
public boolean match(MetadataReader metadataReader,
diff --git a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/AbstractTestNG.java b/spring-boot-project/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-project/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-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java
index 18fc4c0fba05..ba66b544f2bb 100644
--- a/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java
+++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/TestTypeExcludeFilterTests.java
@@ -98,6 +98,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());
}