|
16 | 16 |
|
17 | 17 | package org.springframework.web.servlet;
|
18 | 18 |
|
19 |
| -import static org.hamcrest.CoreMatchers.equalTo; |
20 |
| -import static org.hamcrest.CoreMatchers.instanceOf; |
21 |
| -import static org.hamcrest.CoreMatchers.notNullValue; |
22 |
| -import static org.hamcrest.CoreMatchers.sameInstance; |
23 |
| -import static org.junit.Assert.assertThat; |
24 |
| - |
25 | 19 | import java.io.IOException;
|
26 | 20 | import java.util.Locale;
|
27 | 21 |
|
|
36 | 30 |
|
37 | 31 | import org.springframework.beans.MutablePropertyValues;
|
38 | 32 | import org.springframework.beans.PropertyValue;
|
39 |
| -import org.springframework.tests.sample.beans.TestBean; |
40 | 33 | import org.springframework.context.ConfigurableApplicationContext;
|
41 | 34 | import org.springframework.context.support.DefaultMessageSourceResolvable;
|
42 | 35 | import org.springframework.core.env.ConfigurableEnvironment;
|
43 |
| -import org.springframework.core.env.StandardEnvironment; |
| 36 | +import org.springframework.core.env.DummyEnvironment; |
44 | 37 | import org.springframework.mock.web.test.MockHttpServletRequest;
|
45 | 38 | import org.springframework.mock.web.test.MockHttpServletResponse;
|
46 | 39 | import org.springframework.mock.web.test.MockServletConfig;
|
47 | 40 | import org.springframework.mock.web.test.MockServletContext;
|
| 41 | +import org.springframework.tests.sample.beans.TestBean; |
48 | 42 | import org.springframework.web.bind.EscapedErrors;
|
49 | 43 | import org.springframework.web.context.ConfigurableWebEnvironment;
|
50 | 44 | import org.springframework.web.context.ServletConfigAwareBean;
|
|
65 | 59 | import org.springframework.web.servlet.view.InternalResourceViewResolver;
|
66 | 60 | import org.springframework.web.util.WebUtils;
|
67 | 61 |
|
| 62 | +import static org.hamcrest.CoreMatchers.*; |
| 63 | +import static org.junit.Assert.*; |
| 64 | + |
68 | 65 | /**
|
69 | 66 | * @author Rod Johnson
|
70 | 67 | * @author Juergen Hoeller
|
@@ -842,8 +839,8 @@ public void testEnvironmentOperations() {
|
842 | 839 | servlet.setEnvironment(env1); // should succeed
|
843 | 840 | assertThat(servlet.getEnvironment(), sameInstance(env1));
|
844 | 841 | try {
|
845 |
| - servlet.setEnvironment(new StandardEnvironment()); |
846 |
| - fail("expected exception"); |
| 842 | + servlet.setEnvironment(new DummyEnvironment()); |
| 843 | + fail("expected IllegalArgumentException for non-configurable Environment"); |
847 | 844 | }
|
848 | 845 | catch (IllegalArgumentException ex) {
|
849 | 846 | }
|
|
0 commit comments