2828import java .time .ZonedDateTime ;
2929import java .time .format .DateTimeFormatter ;
3030import java .util .Calendar ;
31+ import java .util .Locale ;
3132
3233import org .junit .Test ;
3334import org .junit .runner .RunWith ;
4950import org .springframework .mock .web .MockHttpServletRequest ;
5051import org .springframework .mock .web .MockHttpServletResponse ;
5152import 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 ;
5454import org .springframework .util .LinkedMultiValueMap ;
5555import org .springframework .util .MultiValueMap ;
5656import org .springframework .web .client .RestTemplate ;
6464/**
6565 * @author Artem Bilan
6666 * @author Gary Russell
67+ *
6768 * @since 3.0
6869 */
69- @ ContextConfiguration
70- @ RunWith (SpringJUnit4ClassRunner .class )
70+ @ RunWith (SpringRunner .class )
7171@ DirtiesContext
7272public class HttpProxyScenarioTests {
7373
@@ -89,8 +89,9 @@ public class HttpProxyScenarioTests {
8989
9090 @ Test
9191 public void testHttpProxyScenario () throws Exception {
92- DateTimeFormatter dateTimeFormatter = DateTimeFormatter .RFC_1123_DATE_TIME ;
9392 ZoneId GMT = ZoneId .of ("GMT" );
93+ DateTimeFormatter dateTimeFormatter =
94+ DateTimeFormatter .ofPattern ("EEE, dd MMM yyyy HH:mm:ss zzz" , Locale .US ).withZone (GMT );
9495
9596 Calendar c = Calendar .getInstance ();
9697 c .set (Calendar .MILLISECOND , 0 );
@@ -132,7 +133,7 @@ public void testHttpProxyScenario() throws Exception {
132133 assertEquals (ifUnmodifiedSinceValue , httpHeaders .getFirst ("If-Unmodified-Since" ));
133134 assertEquals ("Keep-Alive" , httpHeaders .getFirst ("Connection" ));
134135
135- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
136+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
136137 responseHeaders .set ("Connection" , "close" );
137138 responseHeaders .set ("Content-Disposition" , contentDispositionValue );
138139 return new ResponseEntity <>(responseHeaders , HttpStatus .OK );
@@ -189,7 +190,7 @@ public void testHttpMultipartProxyScenario() throws Exception {
189190 assertThat (entity .getBody (), instanceOf (byte [].class ));
190191 assertEquals ("foo" , new String ((byte []) entity .getBody ()));
191192
192- MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <String , String >(httpHeaders );
193+ MultiValueMap <String , String > responseHeaders = new LinkedMultiValueMap <>(httpHeaders );
193194 responseHeaders .set ("Connection" , "close" );
194195 responseHeaders .set ("Content-Type" , "text/plain" );
195196 return new ResponseEntity <>(responseHeaders , HttpStatus .OK );
0 commit comments