Merge branch '2.4.x'
Closes gh-24974
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
* Copyright 2012-2021 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -82,7 +82,7 @@ class FileSessionPersistenceTests {
|
||||
this.persistence.persistSessions("test", sessionData);
|
||||
Map<String, PersistentSession> restored = this.persistence.loadSessionAttributes("test", this.classLoader);
|
||||
assertThat(restored).isNotNull();
|
||||
assertThat(restored.containsKey("abc")).isFalse();
|
||||
assertThat(restored).doesNotContainKey("abc");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -256,8 +256,8 @@ class DefaultErrorAttributesTests {
|
||||
MockServerHttpRequest request = MockServerHttpRequest.get("/test").build();
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(buildServerRequest(request, ex),
|
||||
ErrorAttributeOptions.defaults());
|
||||
assertThat(attributes.get("message")).isEqualTo("");
|
||||
assertThat(attributes.containsKey("errors")).isFalse();
|
||||
assertThat(attributes).containsEntry("message", "");
|
||||
assertThat(attributes).doesNotContainKey("errors");
|
||||
}
|
||||
|
||||
private ServerRequest buildServerRequest(MockServerHttpRequest request, Throwable error) {
|
||||
|
||||
@@ -90,7 +90,7 @@ class DefaultErrorAttributesTests {
|
||||
ErrorAttributeOptions.of(Include.MESSAGE));
|
||||
assertThat(this.errorAttributes.getError(this.webRequest)).isSameAs(ex);
|
||||
assertThat(modelAndView).isNull();
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ class DefaultErrorAttributesTests {
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.of(Include.MESSAGE));
|
||||
assertThat(this.errorAttributes.getError(this.webRequest)).isSameAs(ex);
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ class DefaultErrorAttributesTests {
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.defaults());
|
||||
assertThat(this.errorAttributes.getError(this.webRequest)).isSameAs(ex);
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message").toString()).contains("");
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ class DefaultErrorAttributesTests {
|
||||
this.request.setAttribute("javax.servlet.error.message", "Test");
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.of(Include.MESSAGE));
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ class DefaultErrorAttributesTests {
|
||||
this.request.setAttribute("javax.servlet.error.message", "Test");
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.defaults());
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).asString().contains("");
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ class DefaultErrorAttributesTests {
|
||||
this.request.setAttribute("javax.servlet.error.message", "Test");
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.of(Include.MESSAGE));
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ class DefaultErrorAttributesTests {
|
||||
this.request.setAttribute("javax.servlet.error.exception", new RuntimeException());
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.of(Include.MESSAGE));
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).isEqualTo("No message available");
|
||||
}
|
||||
|
||||
@@ -161,7 +161,7 @@ class DefaultErrorAttributesTests {
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.of(Include.MESSAGE));
|
||||
assertThat(this.errorAttributes.getError(this.webRequest)).isSameAs(wrapped);
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).isEqualTo("Test");
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ class DefaultErrorAttributesTests {
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.of(Include.MESSAGE));
|
||||
assertThat(this.errorAttributes.getError(this.webRequest)).isSameAs(error);
|
||||
assertThat(attributes.containsKey("exception")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("exception");
|
||||
assertThat(attributes.get("message")).isEqualTo("Test error");
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ class DefaultErrorAttributesTests {
|
||||
assertThat(attributes.get("errors")).isEqualTo(bindingResult.getAllErrors());
|
||||
}
|
||||
else {
|
||||
assertThat(attributes.containsKey("errors")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("errors");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ class DefaultErrorAttributesTests {
|
||||
this.request.setAttribute("javax.servlet.error.exception", ex);
|
||||
Map<String, Object> attributes = this.errorAttributes.getErrorAttributes(this.webRequest,
|
||||
ErrorAttributeOptions.defaults());
|
||||
assertThat(attributes.containsKey("trace")).isFalse();
|
||||
assertThat(attributes).doesNotContainKey("trace");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user