|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2020 the original author or authors. |
| 2 | + * Copyright 2002-2021 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.
|
|
24 | 24 | import org.springframework.web.testfixture.servlet.MockHttpServletRequest;
|
25 | 25 |
|
26 | 26 | import static org.assertj.core.api.Assertions.assertThat;
|
27 |
| -import static org.assertj.core.api.Assertions.assertThatCode; |
| 27 | +import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException; |
28 | 28 |
|
29 | 29 | /**
|
30 | 30 | * Unit tests for {@link UrlPathHelper}.
|
@@ -168,8 +168,24 @@ public void getLookupPathWithSemicolonContentAndNullPathInfo() {
|
168 | 168 | }
|
169 | 169 |
|
170 | 170 | @Test // gh-27303
|
171 |
| - public void shouldRemoveSemicolonContentWithReadOnlyInstance() { |
172 |
| - assertThatCode(UrlPathHelper.defaultInstance::shouldRemoveSemicolonContent).doesNotThrowAnyException(); |
| 171 | + public void defaultInstanceReadOnlyBehavior() { |
| 172 | + UrlPathHelper helper = UrlPathHelper.defaultInstance; |
| 173 | + |
| 174 | + assertThatIllegalArgumentException() |
| 175 | + .isThrownBy(() -> helper.setAlwaysUseFullPath(true)) |
| 176 | + .withMessage("This instance cannot be modified"); |
| 177 | + assertThatIllegalArgumentException() |
| 178 | + .isThrownBy(() -> helper.setUrlDecode(true)) |
| 179 | + .withMessage("This instance cannot be modified"); |
| 180 | + assertThatIllegalArgumentException() |
| 181 | + .isThrownBy(() -> helper.setRemoveSemicolonContent(true)) |
| 182 | + .withMessage("This instance cannot be modified"); |
| 183 | + assertThatIllegalArgumentException() |
| 184 | + .isThrownBy(() -> helper.setDefaultEncoding("UTF-8")) |
| 185 | + .withMessage("This instance cannot be modified"); |
| 186 | + |
| 187 | + assertThat(helper.isUrlDecode()).isTrue(); |
| 188 | + assertThat(helper.shouldRemoveSemicolonContent()).isTrue(); |
173 | 189 | }
|
174 | 190 |
|
175 | 191 |
|
|
0 commit comments