25
25
import java .time .ZonedDateTime ;
26
26
import java .time .format .DateTimeFormatter ;
27
27
import java .util .Calendar ;
28
+ import java .util .Locale ;
28
29
29
30
import org .junit .Test ;
30
31
import org .junit .runner .RunWith ;
46
47
import org .springframework .mock .web .MockHttpServletRequest ;
47
48
import org .springframework .mock .web .MockHttpServletResponse ;
48
49
import org .springframework .test .annotation .DirtiesContext ;
49
- import org .springframework .test .context .ContextConfiguration ;
50
- import org .springframework .test .context .junit4 .SpringJUnit4ClassRunner ;
50
+ import org .springframework .test .context .junit4 .SpringRunner ;
51
51
import org .springframework .util .LinkedMultiValueMap ;
52
52
import org .springframework .util .MultiValueMap ;
53
53
import org .springframework .web .client .RestTemplate ;
61
61
/**
62
62
* @author Artem Bilan
63
63
* @author Gary Russell
64
+ *
64
65
* @since 3.0
65
66
*/
66
- @ ContextConfiguration
67
- @ RunWith (SpringJUnit4ClassRunner .class )
67
+ @ RunWith (SpringRunner .class )
68
68
@ DirtiesContext
69
69
public class HttpProxyScenarioTests {
70
70
@@ -86,8 +86,9 @@ public class HttpProxyScenarioTests {
86
86
87
87
@ Test
88
88
public void testHttpProxyScenario () throws Exception {
89
- DateTimeFormatter dateTimeFormatter = DateTimeFormatter .RFC_1123_DATE_TIME ;
90
89
ZoneId GMT = ZoneId .of ("GMT" );
90
+ DateTimeFormatter dateTimeFormatter =
91
+ DateTimeFormatter .ofPattern ("EEE, dd MMM yyyy HH:mm:ss zzz" , Locale .US ).withZone (GMT );
91
92
92
93
Calendar c = Calendar .getInstance ();
93
94
c .set (Calendar .MILLISECOND , 0 );
@@ -129,7 +130,7 @@ public void testHttpProxyScenario() throws Exception {
129
130
assertThat (httpHeaders .getFirst ("If-Unmodified-Since" )).isEqualTo (ifUnmodifiedSinceValue );
130
131
assertThat (httpHeaders .getFirst ("Connection" )).isEqualTo ("Keep-Alive" );
131
132
132
- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
133
+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
133
134
responseHeaders .set ("Connection" , "close" );
134
135
responseHeaders .set ("Content-Disposition" , contentDispositionValue );
135
136
return new ResponseEntity <>(responseHeaders , HttpStatus .OK );
@@ -186,7 +187,7 @@ public void testHttpMultipartProxyScenario() throws Exception {
186
187
assertThat (entity .getBody ()).isInstanceOf (byte [].class );
187
188
assertThat (new String ((byte []) entity .getBody ())).isEqualTo ("foo" );
188
189
189
- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
190
+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
190
191
responseHeaders .set ("Connection" , "close" );
191
192
responseHeaders .set ("Content-Type" , "text/plain" );
192
193
return new ResponseEntity <Object >(responseHeaders , HttpStatus .OK );
0 commit comments