Java Code Examples for org.springframework.web.socket.ContextLoaderTestUtils#setCurrentWebApplicationContext()
The following examples show how to use
org.springframework.web.socket.ContextLoaderTestUtils#setCurrentWebApplicationContext() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConvertingEncoderDecoderSupportTests.java From spring-analysis-note with MIT License | 5 votes |
private void setup(Class<?> configurationClass) { AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); applicationContext.register(configurationClass); applicationContext.refresh(); this.applicationContext = applicationContext; ContextLoaderTestUtils.setCurrentWebApplicationContext(this.applicationContext); }
Example 2
Source File: ConvertingEncoderDecoderSupportTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void cannotFindApplicationContext() throws Exception { ContextLoaderTestUtils.setCurrentWebApplicationContext(null); WithAutowire encoder = new WithAutowire(); encoder.init(null); assertThatIllegalStateException().isThrownBy(() -> encoder.encode(myType)) .withMessageContaining("Unable to locate the Spring ApplicationContext"); }
Example 3
Source File: ConvertingEncoderDecoderSupportTests.java From java-technology-stack with MIT License | 5 votes |
private void setup(Class<?> configurationClass) { AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); applicationContext.register(configurationClass); applicationContext.refresh(); this.applicationContext = applicationContext; ContextLoaderTestUtils.setCurrentWebApplicationContext(this.applicationContext); }
Example 4
Source File: ConvertingEncoderDecoderSupportTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void cannotFindApplicationContext() throws Exception { ContextLoaderTestUtils.setCurrentWebApplicationContext(null); WithAutowire encoder = new WithAutowire(); encoder.init(null); thown.expect(IllegalStateException.class); thown.expectMessage("Unable to locate the Spring ApplicationContext"); encoder.encode(myType); }
Example 5
Source File: ConvertingEncoderDecoderSupportTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
private void setup(Class<?> configurationClass) { AnnotationConfigWebApplicationContext applicationContext = new AnnotationConfigWebApplicationContext(); applicationContext.register(configurationClass); applicationContext.refresh(); this.applicationContext = applicationContext; ContextLoaderTestUtils.setCurrentWebApplicationContext(this.applicationContext); }
Example 6
Source File: ConvertingEncoderDecoderSupportTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void cannotFindApplicationContext() throws Exception { ContextLoaderTestUtils.setCurrentWebApplicationContext(null); WithAutowire encoder = new WithAutowire(); encoder.init(null); thown.expect(IllegalStateException.class); thown.expectMessage("Unable to locate the Spring ApplicationContext"); encoder.encode(myType); }
Example 7
Source File: ConvertingEncoderDecoderSupportTests.java From spring-analysis-note with MIT License | 4 votes |
@After public void teardown() { ContextLoaderTestUtils.setCurrentWebApplicationContext(null); }
Example 8
Source File: ConvertingEncoderDecoderSupportTests.java From java-technology-stack with MIT License | 4 votes |
@After public void teardown() { ContextLoaderTestUtils.setCurrentWebApplicationContext(null); }
Example 9
Source File: ConvertingEncoderDecoderSupportTests.java From spring4-understanding with Apache License 2.0 | 4 votes |
@After public void teardown() { ContextLoaderTestUtils.setCurrentWebApplicationContext(null); }