Clean up warnings in the spring-test module

master
Sam Brannen 9 years ago
parent a5139f3c66
commit 532ed0a4cf
  1. 5
      spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebConnection.java
  2. 3
      spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/DelegatingWebConnectionTests.java
  3. 12
      spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcConnectionBuilderSupportTests.java

@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2016 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
@ -41,8 +41,7 @@ import org.springframework.util.Assert;
* <pre class="code">
* WebClient webClient = new WebClient();
* MockMvc mockMvc = ...
* MockMvcWebConnection webConnection = new MockMvcWebConnection(mockMvc);
* mockConnection.setWebClient(webClient);
* MockMvcWebConnection webConnection = new MockMvcWebConnection(mockMvc, webClient);
* webClient.setWebConnection(webConnection);
*
* // Use webClient as normal ...

@ -131,8 +131,7 @@ public class DelegatingWebConnectionTests {
WebClient webClient = new WebClient();
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(TestController.class).build();
MockMvcWebConnection mockConnection = new MockMvcWebConnection(mockMvc);
mockConnection.setWebClient(webClient);
MockMvcWebConnection mockConnection = new MockMvcWebConnection(mockMvc, webClient);
WebRequestMatcher cdnMatcher = new UrlRegexRequestMatcher(".*?//code.jquery.com/.*");
WebConnection httpConnection = new HttpWebConnection(webClient);

@ -24,6 +24,7 @@ import com.gargoylesoftware.htmlunit.WebClient;
import com.gargoylesoftware.htmlunit.WebConnection;
import com.gargoylesoftware.htmlunit.WebRequest;
import com.gargoylesoftware.htmlunit.WebResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@ -57,19 +58,19 @@ import static org.mockito.Mockito.when;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@WebAppConfiguration
@SuppressWarnings("rawtypes")
public class MockMvcConnectionBuilderSupportTests {
@Autowired
private WebApplicationContext wac;
private WebClient client;
private final WebClient client = mock(WebClient.class);
private MockMvcWebConnectionBuilderSupport builder;
@Autowired
private WebApplicationContext wac;
@Before
public void setup() {
this.client = mock(WebClient.class);
when(this.client.getWebConnection()).thenReturn(mock(WebConnection.class));
this.builder = new MockMvcWebConnectionBuilderSupport(this.wac) {};
}
@ -145,7 +146,6 @@ public class MockMvcConnectionBuilderSupportTests {
@Configuration
@EnableWebMvc
@SuppressWarnings("unused")
static class Config {
@RestController

Loading…
Cancel
Save