diff --git a/spring-boot-project/spring-boot-parent/pom.xml b/spring-boot-project/spring-boot-parent/pom.xml
index 82bcf95c601..bff0ad0b463 100644
--- a/spring-boot-project/spring-boot-parent/pom.xml
+++ b/spring-boot-project/spring-boot-parent/pom.xml
@@ -27,6 +27,7 @@
1.1.1
1.0-groovy-2.4
1.10.6
+ 6.14.3
1.0.6.RELEASE
0.1.0.BUILD-SNAPSHOT
@@ -246,6 +247,11 @@
import
pom
+
+ org.testng
+ testng
+ ${testng.version}
+
org.zeroturnaround
zt-zip
diff --git a/spring-boot-project/spring-boot-test/pom.xml b/spring-boot-project/spring-boot-test/pom.xml
index 0c490191287..1e25028b498 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 9747d041d33..4f1efe67b5a 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 @@ import org.springframework.core.type.classreading.MetadataReaderFactory;
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/AbstractTestNgTestWithConfig.java b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/AbstractTestNgTestWithConfig.java
new file mode 100644
index 00000000000..b11d0b739cd
--- /dev/null
+++ b/spring-boot-project/spring-boot-test/src/test/java/org/springframework/boot/test/context/filter/AbstractTestNgTestWithConfig.java
@@ -0,0 +1,31 @@
+/*
+ * 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.
+ * 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;
+
+@Test
+public abstract class AbstractTestNgTestWithConfig {
+
+ @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 18fc4c0fba0..400d931830b 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
@@ -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.
@@ -98,6 +98,14 @@ public class TestTypeExcludeFilterTests {
this.metadataReaderFactory)).isFalse();
}
+ @Test
+ public void matchesNestedConfigurationClassWithoutTestNgAnnotation()
+ throws Exception {
+ assertThat(this.filter.match(
+ getMetadataReader(AbstractTestNgTestWithConfig.Config.class),
+ this.metadataReaderFactory)).isTrue();
+ }
+
private MetadataReader getMetadataReader(Class> source) throws IOException {
return this.metadataReaderFactory.getMetadataReader(source.getName());
}