28
28
import java .time .ZonedDateTime ;
29
29
import java .time .format .DateTimeFormatter ;
30
30
import java .util .Calendar ;
31
+ import java .util .Locale ;
31
32
32
33
import org .junit .Test ;
33
34
import org .junit .runner .RunWith ;
49
50
import org .springframework .mock .web .MockHttpServletRequest ;
50
51
import org .springframework .mock .web .MockHttpServletResponse ;
51
52
import org .springframework .test .annotation .DirtiesContext ;
52
- import org .springframework .test .context .ContextConfiguration ;
53
- import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
53
+ import org .springframework .test .context .junit4 .SpringRunner ;
54
54
import org .springframework .util .LinkedMultiValueMap ;
55
55
import org .springframework .util .MultiValueMap ;
56
56
import org .springframework .web .client .RestTemplate ;
64
64
/**
65
65
* @author Artem Bilan
66
66
* @author Gary Russell
67
+ *
67
68
* @since 3.0
68
69
*/
69
- @ ContextConfiguration
70
- @ RunWith (SpringJUnit4ClassRunner .class )
70
+ @ RunWith (SpringRunner .class )
71
71
@ DirtiesContext
72
72
public class HttpProxyScenarioTests {
73
73
@@ -89,8 +89,9 @@ public class HttpProxyScenarioTests {
89
89
90
90
@ Test
91
91
public void testHttpProxyScenario () throws Exception {
92
- DateTimeFormatter dateTimeFormatter = DateTimeFormatter .RFC_1123_DATE_TIME ;
93
92
ZoneId GMT = ZoneId .of ("GMT" );
93
+ DateTimeFormatter dateTimeFormatter =
94
+ DateTimeFormatter .ofPattern ("EEE, dd MMM yyyy HH:mm:ss zzz" , Locale .US ).withZone (GMT );
94
95
95
96
Calendar c = Calendar .getInstance ();
96
97
c .set (Calendar .MILLISECOND , 0 );
@@ -132,7 +133,7 @@ public void testHttpProxyScenario() throws Exception {
132
133
assertEquals (ifUnmodifiedSinceValue , httpHeaders .getFirst ("If-Unmodified-Since" ));
133
134
assertEquals ("Keep-Alive" , httpHeaders .getFirst ("Connection" ));
134
135
135
- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
136
+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
136
137
responseHeaders .set ("Connection" , "close" );
137
138
responseHeaders .set ("Content-Disposition" , contentDispositionValue );
138
139
return new ResponseEntity <>(responseHeaders , HttpStatus .OK );
@@ -189,7 +190,7 @@ public void testHttpMultipartProxyScenario() throws Exception {
189
190
assertThat (entity .getBody (), instanceOf (byte [].class ));
190
191
assertEquals ("foo" , new String ((byte []) entity .getBody ()));
191
192
192
- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
193
+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
193
194
responseHeaders .set ("Connection" , "close" );
194
195
responseHeaders .set ("Content-Type" , "text/plain" );
195
196
return new ResponseEntity <>(responseHeaders , HttpStatus .OK );
0 commit comments