2525import java .time .ZonedDateTime ;
2626import java .time .format .DateTimeFormatter ;
2727import java .util .Calendar ;
28+ import java .util .Locale ;
2829
2930import org .junit .Test ;
3031import org .junit .runner .RunWith ;
4647import org .springframework .mock .web .MockHttpServletRequest ;
4748import org .springframework .mock .web .MockHttpServletResponse ;
4849import 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 ;
5151import org .springframework .util .LinkedMultiValueMap ;
5252import org .springframework .util .MultiValueMap ;
5353import org .springframework .web .client .RestTemplate ;
6161/**
6262 * @author Artem Bilan
6363 * @author Gary Russell
64+ *
6465 * @since 3.0
6566 */
66- @ ContextConfiguration
67- @ RunWith (SpringJUnit4ClassRunner .class )
67+ @ RunWith (SpringRunner .class )
6868@ DirtiesContext
6969public class HttpProxyScenarioTests {
7070
@@ -86,8 +86,9 @@ public class HttpProxyScenarioTests {
8686
8787 @ Test
8888 public void testHttpProxyScenario () throws Exception {
89- DateTimeFormatter dateTimeFormatter = DateTimeFormatter .RFC_1123_DATE_TIME ;
9089 ZoneId GMT = ZoneId .of ("GMT" );
90+ DateTimeFormatter dateTimeFormatter =
91+ DateTimeFormatter .ofPattern ("EEE, dd MMM yyyy HH:mm:ss zzz" , Locale .US ).withZone (GMT );
9192
9293 Calendar c = Calendar .getInstance ();
9394 c .set (Calendar .MILLISECOND , 0 );
@@ -129,7 +130,7 @@ public void testHttpProxyScenario() throws Exception {
129130 assertThat (httpHeaders .getFirst ("If-Unmodified-Since" )).isEqualTo (ifUnmodifiedSinceValue );
130131 assertThat (httpHeaders .getFirst ("Connection" )).isEqualTo ("Keep-Alive" );
131132
132- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
133+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
133134 responseHeaders .set ("Connection" , "close" );
134135 responseHeaders .set ("Content-Disposition" , contentDispositionValue );
135136 return new ResponseEntity <>(responseHeaders , HttpStatus .OK );
@@ -186,7 +187,7 @@ public void testHttpMultipartProxyScenario() throws Exception {
186187 assertThat (entity .getBody ()).isInstanceOf (byte [].class );
187188 assertThat (new String ((byte []) entity .getBody ())).isEqualTo ("foo" );
188189
189- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
190+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
190191 responseHeaders .set ("Connection" , "close" );
191192 responseHeaders .set ("Content-Type" , "text/plain" );
192193 return new ResponseEntity <Object >(responseHeaders , HttpStatus .OK );
0 commit comments