Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions spring-boot-dependencies/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
<sqlite-jdbc.version>3.8.11.2</sqlite-jdbc.version>
<statsd-client.version>3.1.0</statsd-client.version>
<sun-mail.version>${javax-mail.version}</sun-mail.version>
<testng.version>6.10</testng.version>
<thymeleaf.version>2.1.5.RELEASE</thymeleaf.version>
<thymeleaf-extras-springsecurity4.version>2.1.2.RELEASE</thymeleaf-extras-springsecurity4.version>
<thymeleaf-extras-conditionalcomments.version>2.1.2.RELEASE</thymeleaf-extras-conditionalcomments.version>
Expand Down Expand Up @@ -2343,6 +2344,11 @@
<artifactId>sqlite-jdbc</artifactId>
<version>${sqlite-jdbc.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>
Expand Down
5 changes: 5 additions & 0 deletions spring-boot-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@
<artifactId>spring-webmvc</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down