Skip to content

Commit 532ed0a

Browse files
committed
Clean up warnings in the spring-test module
1 parent a5139f3 commit 532ed0a

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebConnection.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
55
* use this file except in compliance with the License. You may obtain a copy of
@@ -41,8 +41,7 @@
4141
* <pre class="code">
4242
* WebClient webClient = new WebClient();
4343
* MockMvc mockMvc = ...
44-
* MockMvcWebConnection webConnection = new MockMvcWebConnection(mockMvc);
45-
* mockConnection.setWebClient(webClient);
44+
* MockMvcWebConnection webConnection = new MockMvcWebConnection(mockMvc, webClient);
4645
* webClient.setWebConnection(webConnection);
4746
*
4847
* // Use webClient as normal ...

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/DelegatingWebConnectionTests.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public void verifyExampleInClassLevelJavadoc() throws Exception {
131131
WebClient webClient = new WebClient();
132132

133133
MockMvc mockMvc = MockMvcBuilders.standaloneSetup(TestController.class).build();
134-
MockMvcWebConnection mockConnection = new MockMvcWebConnection(mockMvc);
135-
mockConnection.setWebClient(webClient);
134+
MockMvcWebConnection mockConnection = new MockMvcWebConnection(mockMvc, webClient);
136135

137136
WebRequestMatcher cdnMatcher = new UrlRegexRequestMatcher(".*?//code.jquery.com/.*");
138137
WebConnection httpConnection = new HttpWebConnection(webClient);

spring-test/src/test/java/org/springframework/test/web/servlet/htmlunit/MockMvcConnectionBuilderSupportTests.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import com.gargoylesoftware.htmlunit.WebConnection;
2525
import com.gargoylesoftware.htmlunit.WebRequest;
2626
import com.gargoylesoftware.htmlunit.WebResponse;
27+
2728
import org.junit.Before;
2829
import org.junit.Test;
2930
import org.junit.runner.RunWith;
@@ -57,19 +58,19 @@
5758
@RunWith(SpringJUnit4ClassRunner.class)
5859
@ContextConfiguration
5960
@WebAppConfiguration
61+
@SuppressWarnings("rawtypes")
6062
public class MockMvcConnectionBuilderSupportTests {
6163

62-
@Autowired
63-
private WebApplicationContext wac;
64-
65-
private WebClient client;
64+
private final WebClient client = mock(WebClient.class);
6665

6766
private MockMvcWebConnectionBuilderSupport builder;
6867

68+
@Autowired
69+
private WebApplicationContext wac;
70+
6971

7072
@Before
7173
public void setup() {
72-
this.client = mock(WebClient.class);
7374
when(this.client.getWebConnection()).thenReturn(mock(WebConnection.class));
7475
this.builder = new MockMvcWebConnectionBuilderSupport(this.wac) {};
7576
}
@@ -145,7 +146,6 @@ private WebResponse getResponse(WebConnection connection, String url) throws IOE
145146

146147
@Configuration
147148
@EnableWebMvc
148-
@SuppressWarnings("unused")
149149
static class Config {
150150

151151
@RestController

0 commit comments

Comments
 (0)