use of org.springframework.boot.web.error.ErrorAttributeOptions in project spring-boot by spring-projects.
the class ErrorAttributesOptionsTests method includingFromEmptyAttributesReturnAddedEntry.
@Test
void includingFromEmptyAttributesReturnAddedEntry() {
ErrorAttributeOptions options = ErrorAttributeOptions.of(EnumSet.noneOf(Include.class));
assertThat(options.including(Include.EXCEPTION).getIncludes()).containsOnly(Include.EXCEPTION);
}
use of org.springframework.boot.web.error.ErrorAttributeOptions in project spring-boot by spring-projects.
the class ManagementErrorEndpointTests method errorResponseWithDefaultErrorAttributesSubclassWithoutDelegation.
@Test
void errorResponseWithDefaultErrorAttributesSubclassWithoutDelegation() {
ErrorAttributes attributes = new DefaultErrorAttributes() {
@Override
public Map<String, Object> getErrorAttributes(WebRequest webRequest, ErrorAttributeOptions options) {
return Collections.singletonMap("error", "custom error");
}
};
ManagementErrorEndpoint endpoint = new ManagementErrorEndpoint(attributes, this.errorProperties);
Map<String, Object> response = endpoint.invoke(new ServletWebRequest(new MockHttpServletRequest()));
assertThat(response).containsExactly(entry("error", "custom error"));
}
Aggregations