Polish TestNG integration tests
This commit is contained in:
		
							parent
							
								
									816185233d
								
							
						
					
					
						commit
						197434b3ec
					
				|  | @ -1,5 +1,5 @@ | ||||||
| /* | /* | ||||||
|  * Copyright 2002-2015 the original author or authors. |  * Copyright 2002-2016 the original author or authors. | ||||||
|  * |  * | ||||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); |  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  * you may not use this file except in compliance with the License. |  * you may not use this file except in compliance with the License. | ||||||
|  | @ -171,7 +171,7 @@ public class ClassLevelDirtiesContextTestNGTests { | ||||||
| 	@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class, | 	@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class, | ||||||
| 		DirtiesContextTestExecutionListener.class }, inheritListeners = false) | 		DirtiesContextTestExecutionListener.class }, inheritListeners = false) | ||||||
| 	@ContextConfiguration | 	@ContextConfiguration | ||||||
| 	public static abstract class BaseTestCase extends AbstractTestNGSpringContextTests { | 	static abstract class BaseTestCase extends AbstractTestNGSpringContextTests { | ||||||
| 
 | 
 | ||||||
| 		@Configuration | 		@Configuration | ||||||
| 		static class Config { | 		static class Config { | ||||||
|  | @ -189,75 +189,75 @@ public class ClassLevelDirtiesContextTestNGTests { | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public static final class CleanTestCase extends BaseTestCase { | 	static final class CleanTestCase extends BaseTestCase { | ||||||
| 
 | 
 | ||||||
| 		@org.testng.annotations.Test | 		@org.testng.annotations.Test | ||||||
| 		public void verifyContextWasAutowired() { | 		void verifyContextWasAutowired() { | ||||||
| 			assertApplicationContextWasAutowired(); | 			assertApplicationContextWasAutowired(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@DirtiesContext | 	@DirtiesContext | ||||||
| 	public static class ClassLevelDirtiesContextWithCleanMethodsAndDefaultModeTestCase extends BaseTestCase { | 	static class ClassLevelDirtiesContextWithCleanMethodsAndDefaultModeTestCase extends BaseTestCase { | ||||||
| 
 | 
 | ||||||
| 		@org.testng.annotations.Test | 		@org.testng.annotations.Test | ||||||
| 		public void verifyContextWasAutowired() { | 		void verifyContextWasAutowired() { | ||||||
| 			assertApplicationContextWasAutowired(); | 			assertApplicationContextWasAutowired(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public static class InheritedClassLevelDirtiesContextWithCleanMethodsAndDefaultModeTestCase extends | 	static class InheritedClassLevelDirtiesContextWithCleanMethodsAndDefaultModeTestCase extends | ||||||
| 			ClassLevelDirtiesContextWithCleanMethodsAndDefaultModeTestCase { | 			ClassLevelDirtiesContextWithCleanMethodsAndDefaultModeTestCase { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@DirtiesContext(classMode = ClassMode.AFTER_CLASS) | 	@DirtiesContext(classMode = ClassMode.AFTER_CLASS) | ||||||
| 	public static class ClassLevelDirtiesContextWithCleanMethodsAndAfterClassModeTestCase extends BaseTestCase { | 	static class ClassLevelDirtiesContextWithCleanMethodsAndAfterClassModeTestCase extends BaseTestCase { | ||||||
| 
 | 
 | ||||||
| 		@org.testng.annotations.Test | 		@org.testng.annotations.Test | ||||||
| 		public void verifyContextWasAutowired() { | 		void verifyContextWasAutowired() { | ||||||
| 			assertApplicationContextWasAutowired(); | 			assertApplicationContextWasAutowired(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public static class InheritedClassLevelDirtiesContextWithCleanMethodsAndAfterClassModeTestCase extends | 	static class InheritedClassLevelDirtiesContextWithCleanMethodsAndAfterClassModeTestCase extends | ||||||
| 			ClassLevelDirtiesContextWithCleanMethodsAndAfterClassModeTestCase { | 			ClassLevelDirtiesContextWithCleanMethodsAndAfterClassModeTestCase { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) | 	@DirtiesContext(classMode = ClassMode.AFTER_EACH_TEST_METHOD) | ||||||
| 	public static class ClassLevelDirtiesContextWithAfterEachTestMethodModeTestCase extends BaseTestCase { | 	static class ClassLevelDirtiesContextWithAfterEachTestMethodModeTestCase extends BaseTestCase { | ||||||
| 
 | 
 | ||||||
| 		@org.testng.annotations.Test | 		@org.testng.annotations.Test | ||||||
| 		public void verifyContextWasAutowired1() { | 		void verifyContextWasAutowired1() { | ||||||
| 			assertApplicationContextWasAutowired(); | 			assertApplicationContextWasAutowired(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		@org.testng.annotations.Test | 		@org.testng.annotations.Test | ||||||
| 		public void verifyContextWasAutowired2() { | 		void verifyContextWasAutowired2() { | ||||||
| 			assertApplicationContextWasAutowired(); | 			assertApplicationContextWasAutowired(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		@org.testng.annotations.Test | 		@org.testng.annotations.Test | ||||||
| 		public void verifyContextWasAutowired3() { | 		void verifyContextWasAutowired3() { | ||||||
| 			assertApplicationContextWasAutowired(); | 			assertApplicationContextWasAutowired(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public static class InheritedClassLevelDirtiesContextWithAfterEachTestMethodModeTestCase extends | 	static class InheritedClassLevelDirtiesContextWithAfterEachTestMethodModeTestCase extends | ||||||
| 			ClassLevelDirtiesContextWithAfterEachTestMethodModeTestCase { | 			ClassLevelDirtiesContextWithAfterEachTestMethodModeTestCase { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@DirtiesContext | 	@DirtiesContext | ||||||
| 	public static class ClassLevelDirtiesContextWithDirtyMethodsTestCase extends BaseTestCase { | 	static class ClassLevelDirtiesContextWithDirtyMethodsTestCase extends BaseTestCase { | ||||||
| 
 | 
 | ||||||
| 		@org.testng.annotations.Test | 		@org.testng.annotations.Test | ||||||
| 		@DirtiesContext | 		@DirtiesContext | ||||||
| 		public void dirtyContext() { | 		void dirtyContext() { | ||||||
| 			assertApplicationContextWasAutowired(); | 			assertApplicationContextWasAutowired(); | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	public static class InheritedClassLevelDirtiesContextWithDirtyMethodsTestCase extends | 	static class InheritedClassLevelDirtiesContextWithDirtyMethodsTestCase extends | ||||||
| 			ClassLevelDirtiesContextWithDirtyMethodsTestCase { | 			ClassLevelDirtiesContextWithDirtyMethodsTestCase { | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -54,8 +54,8 @@ import static org.testng.Assert.*; | ||||||
|  * @since 3.1 |  * @since 3.1 | ||||||
|  */ |  */ | ||||||
| @ContextConfiguration | @ContextConfiguration | ||||||
| public class AnnotationConfigTransactionalTestNGSpringContextTests extends | public class AnnotationConfigTransactionalTestNGSpringContextTests | ||||||
| 		AbstractTransactionalTestNGSpringContextTests { | 		extends AbstractTransactionalTestNGSpringContextTests { | ||||||
| 
 | 
 | ||||||
| 	private static final String JANE = "jane"; | 	private static final String JANE = "jane"; | ||||||
| 	private static final String SUE = "sue"; | 	private static final String SUE = "sue"; | ||||||
|  | @ -94,7 +94,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@BeforeClass | 	@BeforeClass | ||||||
| 	public void beforeClass() { | 	void beforeClass() { | ||||||
| 		numSetUpCalls = 0; | 		numSetUpCalls = 0; | ||||||
| 		numSetUpCallsInTransaction = 0; | 		numSetUpCallsInTransaction = 0; | ||||||
| 		numTearDownCalls = 0; | 		numTearDownCalls = 0; | ||||||
|  | @ -102,7 +102,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@AfterClass | 	@AfterClass | ||||||
| 	public void afterClass() { | 	void afterClass() { | ||||||
| 		assertEquals(numSetUpCalls, NUM_TESTS, "number of calls to setUp()."); | 		assertEquals(numSetUpCalls, NUM_TESTS, "number of calls to setUp()."); | ||||||
| 		assertEquals(numSetUpCallsInTransaction, NUM_TX_TESTS, "number of calls to setUp() within a transaction."); | 		assertEquals(numSetUpCallsInTransaction, NUM_TX_TESTS, "number of calls to setUp() within a transaction."); | ||||||
| 		assertEquals(numTearDownCalls, NUM_TESTS, "number of calls to tearDown()."); | 		assertEquals(numTearDownCalls, NUM_TESTS, "number of calls to tearDown()."); | ||||||
|  | @ -111,7 +111,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void autowiringFromConfigClass() { | 	void autowiringFromConfigClass() { | ||||||
| 		assertNotNull(employee, "The employee should have been autowired."); | 		assertNotNull(employee, "The employee should have been autowired."); | ||||||
| 		assertEquals(employee.getName(), "John Smith"); | 		assertEquals(employee.getName(), "John Smith"); | ||||||
| 
 | 
 | ||||||
|  | @ -126,7 +126,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@BeforeMethod | 	@BeforeMethod | ||||||
| 	public void setUp() throws Exception { | 	void setUp() throws Exception { | ||||||
| 		numSetUpCalls++; | 		numSetUpCalls++; | ||||||
| 		if (inTransaction()) { | 		if (inTransaction()) { | ||||||
| 			numSetUpCallsInTransaction++; | 			numSetUpCallsInTransaction++; | ||||||
|  | @ -143,7 +143,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@AfterMethod | 	@AfterMethod | ||||||
| 	public void tearDown() throws Exception { | 	void tearDown() throws Exception { | ||||||
| 		numTearDownCalls++; | 		numTearDownCalls++; | ||||||
| 		if (inTransaction()) { | 		if (inTransaction()) { | ||||||
| 			numTearDownCallsInTransaction++; | 			numTearDownCallsInTransaction++; | ||||||
|  | @ -162,7 +162,7 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends | ||||||
| 	static class ContextConfiguration { | 	static class ContextConfiguration { | ||||||
| 
 | 
 | ||||||
| 		@Bean | 		@Bean | ||||||
| 		public Employee employee() { | 		Employee employee() { | ||||||
| 			Employee employee = new Employee(); | 			Employee employee = new Employee(); | ||||||
| 			employee.setName("John Smith"); | 			employee.setName("John Smith"); | ||||||
| 			employee.setAge(42); | 			employee.setAge(42); | ||||||
|  | @ -171,17 +171,17 @@ public class AnnotationConfigTransactionalTestNGSpringContextTests extends | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		@Bean | 		@Bean | ||||||
| 		public Pet pet() { | 		Pet pet() { | ||||||
| 			return new Pet("Fido"); | 			return new Pet("Fido"); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		@Bean | 		@Bean | ||||||
| 		public PlatformTransactionManager transactionManager() { | 		PlatformTransactionManager transactionManager() { | ||||||
| 			return new DataSourceTransactionManager(dataSource()); | 			return new DataSourceTransactionManager(dataSource()); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		@Bean | 		@Bean | ||||||
| 		public DataSource dataSource() { | 		DataSource dataSource() { | ||||||
| 			return new EmbeddedDatabaseBuilder()// | 			return new EmbeddedDatabaseBuilder()// | ||||||
| 			.addScript("classpath:/org/springframework/test/jdbc/schema.sql")// | 			.addScript("classpath:/org/springframework/test/jdbc/schema.sql")// | ||||||
| 			.addScript("classpath:/org/springframework/test/jdbc/data.sql")// | 			.addScript("classpath:/org/springframework/test/jdbc/data.sql")// | ||||||
|  |  | ||||||
|  | @ -117,7 +117,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@BeforeClass | 	@BeforeClass | ||||||
| 	public void beforeClass() { | 	void beforeClass() { | ||||||
| 		numSetUpCalls = 0; | 		numSetUpCalls = 0; | ||||||
| 		numSetUpCallsInTransaction = 0; | 		numSetUpCallsInTransaction = 0; | ||||||
| 		numTearDownCalls = 0; | 		numTearDownCalls = 0; | ||||||
|  | @ -125,7 +125,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@AfterClass | 	@AfterClass | ||||||
| 	public void afterClass() { | 	void afterClass() { | ||||||
| 		assertEquals(numSetUpCalls, NUM_TESTS, "number of calls to setUp()."); | 		assertEquals(numSetUpCalls, NUM_TESTS, "number of calls to setUp()."); | ||||||
| 		assertEquals(numSetUpCallsInTransaction, NUM_TX_TESTS, "number of calls to setUp() within a transaction."); | 		assertEquals(numSetUpCallsInTransaction, NUM_TX_TESTS, "number of calls to setUp() within a transaction."); | ||||||
| 		assertEquals(numTearDownCalls, NUM_TESTS, "number of calls to tearDown()."); | 		assertEquals(numTearDownCalls, NUM_TESTS, "number of calls to tearDown()."); | ||||||
|  | @ -134,7 +134,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void verifyApplicationContextSet() { | 	void verifyApplicationContextSet() { | ||||||
| 		assertInTransaction(false); | 		assertInTransaction(false); | ||||||
| 		assertNotNull(super.applicationContext, | 		assertNotNull(super.applicationContext, | ||||||
| 			"The application context should have been set due to ApplicationContextAware semantics."); | 			"The application context should have been set due to ApplicationContextAware semantics."); | ||||||
|  | @ -144,7 +144,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void verifyBeanInitialized() { | 	void verifyBeanInitialized() { | ||||||
| 		assertInTransaction(false); | 		assertInTransaction(false); | ||||||
| 		assertTrue(beanInitialized, | 		assertTrue(beanInitialized, | ||||||
| 			"This test instance should have been initialized due to InitializingBean semantics."); | 			"This test instance should have been initialized due to InitializingBean semantics."); | ||||||
|  | @ -152,7 +152,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void verifyBeanNameSet() { | 	void verifyBeanNameSet() { | ||||||
| 		assertInTransaction(false); | 		assertInTransaction(false); | ||||||
| 		assertEquals(beanName, getClass().getName(), | 		assertEquals(beanName, getClass().getName(), | ||||||
| 			"The bean name of this test instance should have been set due to BeanNameAware semantics."); | 			"The bean name of this test instance should have been set due to BeanNameAware semantics."); | ||||||
|  | @ -160,7 +160,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void verifyAnnotationAutowiredFields() { | 	void verifyAnnotationAutowiredFields() { | ||||||
| 		assertInTransaction(false); | 		assertInTransaction(false); | ||||||
| 		assertNull(nonrequiredLong, "The nonrequiredLong field should NOT have been autowired."); | 		assertNull(nonrequiredLong, "The nonrequiredLong field should NOT have been autowired."); | ||||||
| 		assertNotNull(pet, "The pet field should have been autowired."); | 		assertNotNull(pet, "The pet field should have been autowired."); | ||||||
|  | @ -169,7 +169,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void verifyAnnotationAutowiredMethods() { | 	void verifyAnnotationAutowiredMethods() { | ||||||
| 		assertInTransaction(false); | 		assertInTransaction(false); | ||||||
| 		assertNotNull(employee, "The setEmployee() method should have been autowired."); | 		assertNotNull(employee, "The setEmployee() method should have been autowired."); | ||||||
| 		assertEquals(employee.getName(), "John Smith", "employee's name."); | 		assertEquals(employee.getName(), "John Smith", "employee's name."); | ||||||
|  | @ -177,14 +177,14 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void verifyResourceAnnotationInjectedFields() { | 	void verifyResourceAnnotationInjectedFields() { | ||||||
| 		assertInTransaction(false); | 		assertInTransaction(false); | ||||||
| 		assertEquals(foo, "Foo", "The foo field should have been injected via @Resource."); | 		assertEquals(foo, "Foo", "The foo field should have been injected via @Resource."); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | 	@Transactional(propagation = Propagation.NOT_SUPPORTED) | ||||||
| 	public void verifyResourceAnnotationInjectedMethods() { | 	void verifyResourceAnnotationInjectedMethods() { | ||||||
| 		assertInTransaction(false); | 		assertInTransaction(false); | ||||||
| 		assertEquals(bar, "Bar", "The setBar() method should have been injected via @Resource."); | 		assertEquals(bar, "Bar", "The setBar() method should have been injected via @Resource."); | ||||||
| 	} | 	} | ||||||
|  | @ -196,7 +196,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@BeforeMethod | 	@BeforeMethod | ||||||
| 	public void setUp() throws Exception { | 	void setUp() throws Exception { | ||||||
| 		numSetUpCalls++; | 		numSetUpCalls++; | ||||||
| 		if (inTransaction()) { | 		if (inTransaction()) { | ||||||
| 			numSetUpCallsInTransaction++; | 			numSetUpCallsInTransaction++; | ||||||
|  | @ -213,7 +213,7 @@ public class ConcreteTransactionalTestNGSpringContextTests extends AbstractTrans | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@AfterMethod | 	@AfterMethod | ||||||
| 	public void tearDown() throws Exception { | 	void tearDown() throws Exception { | ||||||
| 		numTearDownCalls++; | 		numTearDownCalls++; | ||||||
| 		if (inTransaction()) { | 		if (inTransaction()) { | ||||||
| 			numTearDownCallsInTransaction++; | 			numTearDownCallsInTransaction++; | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| /* | /* | ||||||
|  * Copyright 2002-2014 the original author or authors. |  * Copyright 2002-2016 the original author or authors. | ||||||
|  * |  * | ||||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); |  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  * you may not use this file except in compliance with the License. |  * you may not use this file except in compliance with the License. | ||||||
|  | @ -57,7 +57,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract | ||||||
| 	 * @see #ensureMocksAreReinjectedBetweenTests_2 | 	 * @see #ensureMocksAreReinjectedBetweenTests_2 | ||||||
| 	 */ | 	 */ | ||||||
| 	@Test | 	@Test | ||||||
| 	public void ensureMocksAreReinjectedBetweenTests_1() { | 	void ensureMocksAreReinjectedBetweenTests_1() { | ||||||
| 		assertInjectedServletRequestEqualsRequestInRequestContextHolder(); | 		assertInjectedServletRequestEqualsRequestInRequestContextHolder(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -67,7 +67,7 @@ public class ServletTestExecutionListenerTestNGIntegrationTests extends Abstract | ||||||
| 	 * @see #ensureMocksAreReinjectedBetweenTests_1 | 	 * @see #ensureMocksAreReinjectedBetweenTests_1 | ||||||
| 	 */ | 	 */ | ||||||
| 	@Test | 	@Test | ||||||
| 	public void ensureMocksAreReinjectedBetweenTests_2() { | 	void ensureMocksAreReinjectedBetweenTests_2() { | ||||||
| 		assertInjectedServletRequestEqualsRequestInRequestContextHolder(); | 		assertInjectedServletRequestEqualsRequestInRequestContextHolder(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1,5 +1,5 @@ | ||||||
| /* | /* | ||||||
|  * Copyright 2002-2014 the original author or authors. |  * Copyright 2002-2016 the original author or authors. | ||||||
|  * |  * | ||||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); |  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
|  * you may not use this file except in compliance with the License. |  * you may not use this file except in compliance with the License. | ||||||
|  | @ -52,34 +52,34 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest | ||||||
| 	static class Config { | 	static class Config { | ||||||
| 
 | 
 | ||||||
| 		@Bean | 		@Bean | ||||||
| 		public String foo() { | 		String foo() { | ||||||
| 			return "enigma"; | 			return "enigma"; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	protected ServletContext servletContext; | 	ServletContext servletContext; | ||||||
| 
 | 
 | ||||||
| 	@Autowired | 	@Autowired | ||||||
| 	protected WebApplicationContext wac; | 	WebApplicationContext wac; | ||||||
| 
 | 
 | ||||||
| 	@Autowired | 	@Autowired | ||||||
| 	protected MockServletContext mockServletContext; | 	MockServletContext mockServletContext; | ||||||
| 
 | 
 | ||||||
| 	@Autowired | 	@Autowired | ||||||
| 	protected MockHttpServletRequest request; | 	MockHttpServletRequest request; | ||||||
| 
 | 
 | ||||||
| 	@Autowired | 	@Autowired | ||||||
| 	protected MockHttpServletResponse response; | 	MockHttpServletResponse response; | ||||||
| 
 | 
 | ||||||
| 	@Autowired | 	@Autowired | ||||||
| 	protected MockHttpSession session; | 	MockHttpSession session; | ||||||
| 
 | 
 | ||||||
| 	@Autowired | 	@Autowired | ||||||
| 	protected ServletWebRequest webRequest; | 	ServletWebRequest webRequest; | ||||||
| 
 | 
 | ||||||
| 	@Autowired | 	@Autowired | ||||||
| 	protected String foo; | 	String foo; | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	@Override | 	@Override | ||||||
|  | @ -88,7 +88,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void basicWacFeatures() throws Exception { | 	void basicWacFeatures() throws Exception { | ||||||
| 		assertNotNull("ServletContext should be set in the WAC.", wac.getServletContext()); | 		assertNotNull("ServletContext should be set in the WAC.", wac.getServletContext()); | ||||||
| 
 | 
 | ||||||
| 		assertNotNull("ServletContext should have been set via ServletContextAware.", servletContext); | 		assertNotNull("ServletContext should have been set via ServletContextAware.", servletContext); | ||||||
|  | @ -112,7 +112,7 @@ public class TestNGSpringContextWebTests extends AbstractTestNGSpringContextTest | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	@Test | 	@Test | ||||||
| 	public void fooEnigmaAutowired() { | 	void fooEnigmaAutowired() { | ||||||
| 		assertEquals("enigma", foo); | 		assertEquals("enigma", foo); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue