This commit is contained in:
Johnny Lim
2023-02-15 22:22:58 +09:00
parent 3e3f046dc9
commit ce3be72e7f
18 changed files with 49 additions and 51 deletions

View File

@@ -68,7 +68,7 @@ public final class MockMvcWebConnection implements WebConnection {
private WebClient webClient;
private static int MAX_FORWARDS = 100;
private static final int MAX_FORWARDS = 100;
/**
@@ -143,7 +143,7 @@ public final class MockMvcWebConnection implements WebConnection {
forwards += 1;
}
if (forwards == MAX_FORWARDS) {
throw new IllegalStateException("Forwarded more than " + forwards + " times in a row, potential infinite forward loop");
throw new IllegalStateException("Forwarded " + forwards + " times in a row, potential infinite forward loop");
}
storeCookies(webRequest, httpServletResponse.getCookies());

View File

@@ -85,7 +85,7 @@ public class MockMvcWebConnectionTests {
public void infiniteForward() {
this.webClient.setWebConnection(new MockMvcWebConnection(this.mockMvc, this.webClient, ""));
assertThatIllegalStateException().isThrownBy(() -> this.webClient.getPage("http://localhost/infiniteForward"))
.withMessage("Forwarded more than 100 times in a row, potential infinite forward loop");
.withMessage("Forwarded 100 times in a row, potential infinite forward loop");
}
@Test