Merge branch '5.1.x'

This commit is contained in:
Sam Brannen
2019-06-06 17:40:51 +03:00
3 changed files with 42 additions and 16 deletions

View File

@@ -282,12 +282,20 @@ public class MockHttpServletRequestTests {
Cookie[] cookies = request.getCookies();
List<String> cookieHeaders = Collections.list(request.getHeaders("Cookie"));
assertThat(cookies.length).isEqualTo(2);
assertThat(cookies[0].getName()).isEqualTo("foo");
assertThat(cookies[0].getValue()).isEqualTo("bar");
assertThat(cookies[1].getName()).isEqualTo("baz");
assertThat(cookies[1].getValue()).isEqualTo("qux");
assertThat(cookieHeaders).isEqualTo(Arrays.asList("foo=bar", "baz=qux"));
assertThat(cookies)
.describedAs("Raw cookies stored as is")
.hasSize(2)
.satisfies(subject -> {
assertThat(subject[0].getName()).isEqualTo("foo");
assertThat(subject[0].getValue()).isEqualTo("bar");
assertThat(subject[1].getName()).isEqualTo("baz");
assertThat(subject[1].getValue()).isEqualTo("qux");
});
assertThat(cookieHeaders)
.describedAs("Cookies -> Header conversion works as expected per RFC6265")
.hasSize(1)
.hasOnlyOneElementSatisfying(header -> assertThat(header).isEqualTo("foo=bar; baz=qux"));
}
@Test