|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2019 the original author or authors. |
| 2 | + * Copyright 2002-2022 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
@@ -46,41 +46,45 @@ public class RelativeRedirectFilterTests {
|
46 | 46 |
|
47 | 47 |
|
48 | 48 | @Test
|
49 |
| - public void sendRedirectHttpStatusWhenNullThenIllegalArgumentException() { |
| 49 | + void sendRedirectHttpStatusWhenNullThenIllegalArgumentException() { |
50 | 50 | assertThatIllegalArgumentException().isThrownBy(() ->
|
51 | 51 | this.filter.setRedirectStatus(null));
|
52 | 52 | }
|
53 | 53 |
|
54 | 54 | @Test
|
55 |
| - public void sendRedirectHttpStatusWhenNot3xxThenIllegalArgumentException() { |
| 55 | + void sendRedirectHttpStatusWhenNot3xxThenIllegalArgumentException() { |
56 | 56 | assertThatIllegalArgumentException().isThrownBy(() ->
|
57 | 57 | this.filter.setRedirectStatus(HttpStatus.OK));
|
58 | 58 | }
|
59 | 59 |
|
60 | 60 | @Test
|
61 |
| - public void doFilterSendRedirectWhenDefaultsThenLocationAnd303() throws Exception { |
| 61 | + void doFilterSendRedirectWhenDefaultsThenLocationAnd303() throws Exception { |
62 | 62 | String location = "/foo";
|
63 | 63 | sendRedirect(location);
|
64 | 64 |
|
65 | 65 | InOrder inOrder = Mockito.inOrder(this.response);
|
| 66 | + inOrder.verify(this.response).resetBuffer(); |
66 | 67 | inOrder.verify(this.response).setStatus(HttpStatus.SEE_OTHER.value());
|
67 | 68 | inOrder.verify(this.response).setHeader(HttpHeaders.LOCATION, location);
|
| 69 | + inOrder.verify(this.response).flushBuffer(); |
68 | 70 | }
|
69 | 71 |
|
70 | 72 | @Test
|
71 |
| - public void doFilterSendRedirectWhenCustomSendRedirectHttpStatusThenLocationAnd301() throws Exception { |
| 73 | + void doFilterSendRedirectWhenCustomSendRedirectHttpStatusThenLocationAnd301() throws Exception { |
72 | 74 | String location = "/foo";
|
73 | 75 | HttpStatus status = HttpStatus.MOVED_PERMANENTLY;
|
74 | 76 | this.filter.setRedirectStatus(status);
|
75 | 77 | sendRedirect(location);
|
76 | 78 |
|
77 | 79 | InOrder inOrder = Mockito.inOrder(this.response);
|
| 80 | + inOrder.verify(this.response).resetBuffer(); |
78 | 81 | inOrder.verify(this.response).setStatus(status.value());
|
79 | 82 | inOrder.verify(this.response).setHeader(HttpHeaders.LOCATION, location);
|
| 83 | + inOrder.verify(this.response).flushBuffer(); |
80 | 84 | }
|
81 | 85 |
|
82 | 86 | @Test
|
83 |
| - public void wrapOnceOnly() throws Exception { |
| 87 | + void wrapOnceOnly() throws Exception { |
84 | 88 | HttpServletResponse original = new MockHttpServletResponse();
|
85 | 89 |
|
86 | 90 | MockFilterChain chain = new MockFilterChain();
|
|
0 commit comments