Skip to content

Commit c520097

Browse files
committed
Polishing
1 parent 11221f5 commit c520097

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@
2424
import com.gargoylesoftware.htmlunit.WebRequest;
2525
import com.gargoylesoftware.htmlunit.WebResponse;
2626
import com.gargoylesoftware.htmlunit.util.Cookie;
27+
2728
import org.junit.Before;
2829
import org.junit.Test;
2930
import org.junit.runner.RunWith;
3031

3132
import org.springframework.beans.factory.annotation.Autowired;
3233
import org.springframework.context.annotation.Configuration;
3334
import org.springframework.test.context.ContextConfiguration;
34-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
35+
import org.springframework.test.context.junit4.SpringRunner;
3536
import org.springframework.test.context.web.WebAppConfiguration;
3637
import org.springframework.test.web.servlet.MockMvc;
3738
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@@ -55,7 +56,7 @@
5556
* @author Rossen Stoyanchev
5657
* @since 4.2
5758
*/
58-
@RunWith(SpringJUnit4ClassRunner.class)
59+
@RunWith(SpringRunner.class)
5960
@ContextConfiguration
6061
@WebAppConfiguration
6162
public class MockMvcWebClientBuilderTests {
@@ -139,9 +140,11 @@ public String contextPath(HttpServletRequest request) {
139140

140141
@RestController
141142
static class CookieController {
142-
@RequestMapping(value="/", produces="text/plain")
143-
public String cookie(@CookieValue("cookie") String cookie) {
143+
144+
@RequestMapping(path = "/", produces = "text/plain")
145+
String cookie(@CookieValue("cookie") String cookie) {
144146
return cookie;
145147
}
146148
}
149+
147150
}

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

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import org.springframework.beans.factory.annotation.Autowired;
2929
import org.springframework.context.annotation.Configuration;
3030
import org.springframework.test.context.ContextConfiguration;
31-
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
31+
import org.springframework.test.context.junit4.SpringRunner;
3232
import org.springframework.test.context.web.WebAppConfiguration;
3333
import org.springframework.test.web.servlet.MockMvc;
3434
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@@ -54,7 +54,7 @@
5454
* @author Sam Brannen
5555
* @since 4.2
5656
*/
57-
@RunWith(SpringJUnit4ClassRunner.class)
57+
@RunWith(SpringRunner.class)
5858
@ContextConfiguration
5959
@WebAppConfiguration
6060
public class MockMvcHtmlUnitDriverBuilderTests {
@@ -124,7 +124,7 @@ public void cookieManagerShared() throws Exception {
124124
assertThat(get("http://localhost/"), equalTo(""));
125125
Cookie cookie = new Cookie("localhost", "cookie", "cookieManagerShared");
126126
otherDriver.getWebClient().getCookieManager().addCookie(cookie);
127-
assertThat(get("http://localhost/"), containsString("cookieManagerShared"));
127+
assertThat(get("http://localhost/"), equalTo("cookieManagerShared"));
128128
}
129129

130130

@@ -158,9 +158,11 @@ public String contextPath(HttpServletRequest request) {
158158

159159
@RestController
160160
static class CookieController {
161-
@RequestMapping(value="/", produces="text/plain")
162-
public String cookie(@CookieValue("cookie") String cookie) {
161+
162+
@RequestMapping(path = "/", produces = "text/plain")
163+
String cookie(@CookieValue("cookie") String cookie) {
163164
return cookie;
164165
}
165166
}
166-
}
167+
168+
}

0 commit comments

Comments
 (0)