Skip to content

Commit a425512

Browse files
committed
Polish
See gh-29050
1 parent 298c9a6 commit a425512

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

spring-web/src/test/java/org/springframework/web/filter/RelativeRedirectFilterTests.java

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -46,41 +46,45 @@ public class RelativeRedirectFilterTests {
4646

4747

4848
@Test
49-
public void sendRedirectHttpStatusWhenNullThenIllegalArgumentException() {
49+
void sendRedirectHttpStatusWhenNullThenIllegalArgumentException() {
5050
assertThatIllegalArgumentException().isThrownBy(() ->
5151
this.filter.setRedirectStatus(null));
5252
}
5353

5454
@Test
55-
public void sendRedirectHttpStatusWhenNot3xxThenIllegalArgumentException() {
55+
void sendRedirectHttpStatusWhenNot3xxThenIllegalArgumentException() {
5656
assertThatIllegalArgumentException().isThrownBy(() ->
5757
this.filter.setRedirectStatus(HttpStatus.OK));
5858
}
5959

6060
@Test
61-
public void doFilterSendRedirectWhenDefaultsThenLocationAnd303() throws Exception {
61+
void doFilterSendRedirectWhenDefaultsThenLocationAnd303() throws Exception {
6262
String location = "/foo";
6363
sendRedirect(location);
6464

6565
InOrder inOrder = Mockito.inOrder(this.response);
66+
inOrder.verify(this.response).resetBuffer();
6667
inOrder.verify(this.response).setStatus(HttpStatus.SEE_OTHER.value());
6768
inOrder.verify(this.response).setHeader(HttpHeaders.LOCATION, location);
69+
inOrder.verify(this.response).flushBuffer();
6870
}
6971

7072
@Test
71-
public void doFilterSendRedirectWhenCustomSendRedirectHttpStatusThenLocationAnd301() throws Exception {
73+
void doFilterSendRedirectWhenCustomSendRedirectHttpStatusThenLocationAnd301() throws Exception {
7274
String location = "/foo";
7375
HttpStatus status = HttpStatus.MOVED_PERMANENTLY;
7476
this.filter.setRedirectStatus(status);
7577
sendRedirect(location);
7678

7779
InOrder inOrder = Mockito.inOrder(this.response);
80+
inOrder.verify(this.response).resetBuffer();
7881
inOrder.verify(this.response).setStatus(status.value());
7982
inOrder.verify(this.response).setHeader(HttpHeaders.LOCATION, location);
83+
inOrder.verify(this.response).flushBuffer();
8084
}
8185

8286
@Test
83-
public void wrapOnceOnly() throws Exception {
87+
void wrapOnceOnly() throws Exception {
8488
HttpServletResponse original = new MockHttpServletResponse();
8589

8690
MockFilterChain chain = new MockFilterChain();

0 commit comments

Comments
 (0)