Merge branch '5.3.x'
This commit is contained in:
@@ -48,7 +48,7 @@ public class AnnotationConfigTestNGSpringContextTests extends AbstractTestNGSpri
|
||||
Pet pet;
|
||||
|
||||
@Test
|
||||
void autowiringFromConfigClass() {
|
||||
public void autowiringFromConfigClass() {
|
||||
assertThat(employee).as("The employee should have been autowired.").isNotNull();
|
||||
assertThat(employee.getName()).isEqualTo("John Smith");
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void autowiringFromConfigClass() {
|
||||
public void autowiringFromConfigClass() {
|
||||
assertThat(employee).as("The employee should have been autowired.").isNotNull();
|
||||
assertThat(employee.getName()).isEqualTo("John Smith");
|
||||
|
||||
@@ -136,7 +136,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests
|
||||
}
|
||||
|
||||
@Test
|
||||
void modifyTestDataWithinTransaction() {
|
||||
public void modifyTestDataWithinTransaction() {
|
||||
assertThatTransaction().isActive();
|
||||
assertAddPerson(JANE);
|
||||
assertAddPerson(SUE);
|
||||
|
||||
@@ -150,7 +150,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void verifyBeanNameSet() {
|
||||
public void verifyBeanNameSet() {
|
||||
assertThatTransaction().isNotActive();
|
||||
assertThat(this.beanName)
|
||||
.as("The bean name of this test instance should have been set to the fully qualified class name due to BeanNameAware semantics.")
|
||||
@@ -159,7 +159,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void verifyApplicationContextSet() {
|
||||
public void verifyApplicationContextSet() {
|
||||
assertThatTransaction().isNotActive();
|
||||
assertThat(super.applicationContext)
|
||||
.as("The application context should have been set due to ApplicationContextAware semantics.")
|
||||
@@ -170,7 +170,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void verifyBeanInitialized() {
|
||||
public void verifyBeanInitialized() {
|
||||
assertThatTransaction().isNotActive();
|
||||
assertThat(beanInitialized)
|
||||
.as("This test instance should have been initialized due to InitializingBean semantics.")
|
||||
@@ -179,7 +179,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void verifyAnnotationAutowiredFields() {
|
||||
public void verifyAnnotationAutowiredFields() {
|
||||
assertThatTransaction().isNotActive();
|
||||
assertThat(nonrequiredLong).as("The nonrequiredLong field should NOT have been autowired.").isNull();
|
||||
assertThat(pet).as("The pet field should have been autowired.").isNotNull();
|
||||
@@ -188,7 +188,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void verifyAnnotationAutowiredMethods() {
|
||||
public void verifyAnnotationAutowiredMethods() {
|
||||
assertThatTransaction().isNotActive();
|
||||
assertThat(employee).as("The setEmployee() method should have been autowired.").isNotNull();
|
||||
assertThat(employee.getName()).as("employee's name.").isEqualTo("John Smith");
|
||||
@@ -196,20 +196,20 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void verifyResourceAnnotationInjectedFields() {
|
||||
public void verifyResourceAnnotationInjectedFields() {
|
||||
assertThatTransaction().isNotActive();
|
||||
assertThat(foo).as("The foo field should have been injected via @Resource.").isEqualTo("Foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||
void verifyResourceAnnotationInjectedMethods() {
|
||||
public void verifyResourceAnnotationInjectedMethods() {
|
||||
assertThatTransaction().isNotActive();
|
||||
assertThat(bar).as("The setBar() method should have been injected via @Resource.").isEqualTo("Bar");
|
||||
}
|
||||
|
||||
@Test
|
||||
void modifyTestDataWithinTransaction() {
|
||||
public void modifyTestDataWithinTransaction() {
|
||||
assertThatTransaction().isActive();
|
||||
assertAddPerson(JANE);
|
||||
assertAddPerson(SUE);
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright 2002-2021 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
|
||||
*
|
||||
* https://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.test.context.testng;
|
||||
|
||||
import org.junit.platform.suite.api.IncludeEngines;
|
||||
import org.junit.platform.suite.api.SelectPackages;
|
||||
import org.junit.platform.suite.api.Suite;
|
||||
|
||||
/**
|
||||
* JUnit Platform based test suite for tests written in TestNG that involve the
|
||||
* Spring TestContext Framework.
|
||||
*
|
||||
* <p><strong>This suite is only intended to be used manually within an IDE.</strong>
|
||||
*
|
||||
* <h3>Logging Configuration</h3>
|
||||
*
|
||||
* <p>In order for our log4j2 configuration to be used in an IDE, you must set the
|
||||
* following system property before running any tests — for example, in
|
||||
* <em>Run Configurations</em> in Eclipse.
|
||||
*
|
||||
* <pre style="code">
|
||||
* -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager
|
||||
* </pre>
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 5.3.11
|
||||
*/
|
||||
@Suite
|
||||
@IncludeEngines("testng")
|
||||
@SelectPackages("org.springframework.test.context.testng")
|
||||
class TestNGTestSuite {
|
||||
}
|
||||
@@ -72,12 +72,12 @@ class TestNGApplicationEventsIntegrationTests extends AbstractTestNGSpringContex
|
||||
}
|
||||
|
||||
@Test
|
||||
void test1() {
|
||||
public void test1() {
|
||||
assertTestExpectations("test1");
|
||||
}
|
||||
|
||||
@Test
|
||||
void test2() {
|
||||
public void test2() {
|
||||
assertTestExpectations("test2");
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract
|
||||
* @see #ensureMocksAreReinjectedBetweenTests_2
|
||||
*/
|
||||
@Test
|
||||
void ensureMocksAreReinjectedBetweenTests_1() {
|
||||
public void ensureMocksAreReinjectedBetweenTests_1() {
|
||||
assertInjectedServletRequestEqualsRequestInRequestContextHolder();
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract
|
||||
* @see #ensureMocksAreReinjectedBetweenTests_1
|
||||
*/
|
||||
@Test
|
||||
void ensureMocksAreReinjectedBetweenTests_2() {
|
||||
public void ensureMocksAreReinjectedBetweenTests_2() {
|
||||
assertInjectedServletRequestEqualsRequestInRequestContextHolder();
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest
|
||||
}
|
||||
|
||||
@Test
|
||||
void basicWacFeatures() throws Exception {
|
||||
public void basicWacFeatures() throws Exception {
|
||||
assertThat(wac.getServletContext()).as("ServletContext should be set in the WAC.").isNotNull();
|
||||
|
||||
assertThat(servletContext).as("ServletContext should have been set via ServletContextAware.").isNotNull();
|
||||
@@ -113,7 +113,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest
|
||||
}
|
||||
|
||||
@Test
|
||||
void fooEnigmaAutowired() {
|
||||
public void fooEnigmaAutowired() {
|
||||
assertThat(foo).isEqualTo("enigma");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user