You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ma...@apache.org on 2018/05/25 12:23:11 UTC
james-project git commit: JAMES-2314 Better handle exceptions in
webAdmin
Repository: james-project
Updated Branches:
refs/heads/master 6c61cdcc7 -> 99549a88e
JAMES-2314 Better handle exceptions in webAdmin
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/99549a88
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/99549a88
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/99549a88
Branch: refs/heads/master
Commit: 99549a88ea053723991f0316b984535122ba3bd8
Parents: 6c61cdc
Author: duc <tr...@gmail.com>
Authored: Thu May 17 16:28:39 2018 +0700
Committer: Matthieu Baechler <ma...@apache.org>
Committed: Fri May 25 14:22:36 2018 +0200
----------------------------------------------------------------------
.../routes/CassandraMigrationRoutesTest.java | 2 +-
.../apache/james/webadmin/WebAdminServer.java | 34 +++++++
.../james/webadmin/utils/ErrorResponder.java | 42 ++++++--
.../webadmin/utils/JsonExtractException.java | 2 +-
.../james/webadmin/routes/ErrorRoutes.java | 50 ++++++++++
.../james/webadmin/routes/ErrorRoutesTest.java | 100 +++++++++++++++++++
.../webadmin/utils/ErrorResponderTest.java | 2 +-
.../webadmin/routes/ForwardRoutesTest.java | 53 ++++------
.../james/webadmin/routes/GroupsRoutesTest.java | 53 ++++------
.../webadmin/routes/DomainQuotaRoutesTest.java | 4 +-
.../webadmin/routes/GlobalQuotaRoutesTest.java | 4 +-
.../routes/UserMailboxesRoutesTest.java | 68 +++++--------
.../webadmin/routes/UserQuotaRoutesTest.java | 4 +-
.../routes/MailRepositoriesRoutesTest.java | 2 +-
14 files changed, 286 insertions(+), 134 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java b/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
index 700b539..b3f1fc9 100644
--- a/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-cassandra/src/test/java/org/apache/james/webadmin/routes/CassandraMigrationRoutesTest.java
@@ -169,7 +169,7 @@ public class CassandraMigrationRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "Invalid request for version upgrade")
- .containsEntry("cause", "For input string: \"NonInt\"");
+ .containsEntry("details", "For input string: \"NonInt\"");
verifyNoMoreInteractions(schemaVersionDAO);
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
index c21ab8c..3ec06f9 100644
--- a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
+++ b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/WebAdminServer.java
@@ -19,6 +19,13 @@
package org.apache.james.webadmin;
+import static org.apache.james.webadmin.utils.ErrorResponder.ErrorType.INVALID_ARGUMENT;
+import static org.apache.james.webadmin.utils.ErrorResponder.ErrorType.NOT_FOUND;
+import static org.apache.james.webadmin.utils.ErrorResponder.ErrorType.SERVER_ERROR;
+import static org.eclipse.jetty.http.HttpStatus.BAD_REQUEST_400;
+import static org.eclipse.jetty.http.HttpStatus.INTERNAL_SERVER_ERROR_500;
+import static org.eclipse.jetty.http.HttpStatus.NOT_FOUND_404;
+
import java.util.Set;
import javax.annotation.PreDestroy;
@@ -37,6 +44,8 @@ import org.apache.james.webadmin.mdc.MDCFilter;
import org.apache.james.webadmin.metric.MetricPostFilter;
import org.apache.james.webadmin.metric.MetricPreFilter;
import org.apache.james.webadmin.routes.CORSRoute;
+import org.apache.james.webadmin.utils.ErrorResponder;
+import org.apache.james.webadmin.utils.JsonExtractException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,6 +81,7 @@ public class WebAdminServer implements Configurable {
public void configure(HierarchicalConfiguration config) throws ConfigurationException {
if (configuration.isEnabled()) {
service.port(configuration.getPort().get().getValue());
+ configureExceptionHanding();
configureHTTPS();
configureCORS();
configureMetrics();
@@ -116,6 +126,30 @@ public class WebAdminServer implements Configurable {
}
}
+ private void configureExceptionHanding() {
+ service.notFound((req, res) -> ErrorResponder.builder()
+ .statusCode(NOT_FOUND_404)
+ .type(NOT_FOUND)
+ .message(String.format("%s %s can not be found", req.requestMethod(), req.pathInfo()))
+ .asString());
+
+ service.internalServerError((req, res) -> ErrorResponder.builder()
+ .statusCode(INTERNAL_SERVER_ERROR_500)
+ .type(SERVER_ERROR)
+ .message("WebAdmin encountered an unexpected internal error")
+ .asString());
+
+ service.exception(JsonExtractException.class, (ex, req, res) -> {
+ res.status(BAD_REQUEST_400);
+ res.body(ErrorResponder.builder()
+ .statusCode(BAD_REQUEST_400)
+ .type(INVALID_ARGUMENT)
+ .message("JSON payload of the request is not valid")
+ .cause(ex)
+ .asString());
+ });
+ }
+
@PreDestroy
public void destroy() {
if (configuration.isEnabled()) {
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/ErrorResponder.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/ErrorResponder.java b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/ErrorResponder.java
index b02883d..73dde47 100644
--- a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/ErrorResponder.java
+++ b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/ErrorResponder.java
@@ -24,6 +24,9 @@ import static spark.Spark.halt;
import java.util.Objects;
import java.util.Optional;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
import com.fasterxml.jackson.core.JsonProcessingException;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
@@ -31,6 +34,9 @@ import com.google.common.base.Preconditions;
import spark.HaltException;
public class ErrorResponder {
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ErrorResponder.class);
+
public enum ErrorType {
INVALID_ARGUMENT("InvalidArgument"),
NOT_FOUND("notFound"),
@@ -86,27 +92,41 @@ public class ErrorResponder {
Preconditions.checkNotNull(type, "type must not be null in case of error");
Preconditions.checkNotNull(message, "message must not be null in case of error");
try {
- return halt(statusCode, new JsonTransformer().render(new ErrorDetail(statusCode,
- type.getType(),
- message,
- cause.map(e -> Optional.ofNullable(e.getMessage())).orElse(Optional.empty()))));
+ return halt(statusCode, generateBody());
} catch (JsonProcessingException e) {
return halt(statusCode);
}
}
+ public String asString() {
+ try {
+ return generateBody();
+ } catch (JsonProcessingException e) {
+ LOGGER.error("Failed handling Error response formatting", e);
+ throw new RuntimeException(e);
+ }
+ }
+
+ private String generateBody() throws JsonProcessingException {
+ return new JsonTransformer().render(new ErrorDetail(
+ statusCode,
+ type.getType(),
+ message,
+ cause.map(Throwable::getMessage)));
+ }
+
static class ErrorDetail {
private final int statusCode;
private final String type;
private final String message;
- private final Optional<String> cause;
+ private final Optional<String> details;
@VisibleForTesting
- ErrorDetail(int statusCode, String type, String message, Optional<String> cause) {
+ ErrorDetail(int statusCode, String type, String message, Optional<String> details) {
this.statusCode = statusCode;
this.type = type;
this.message = message;
- this.cause = cause;
+ this.details = details;
}
public int getStatusCode() {
@@ -121,8 +141,8 @@ public class ErrorResponder {
return message;
}
- public Optional<String> getCause() {
- return cause;
+ public Optional<String> getDetails() {
+ return details;
}
@Override
@@ -133,14 +153,14 @@ public class ErrorResponder {
return Objects.equals(this.statusCode, that.statusCode)
&& Objects.equals(this.type, that.type)
&& Objects.equals(this.message, that.message)
- && Objects.equals(this.cause, that.cause);
+ && Objects.equals(this.details, that.details);
}
return false;
}
@Override
public final int hashCode() {
- return Objects.hash(statusCode, type, message, cause);
+ return Objects.hash(statusCode, type, message, details);
}
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/JsonExtractException.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/JsonExtractException.java b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/JsonExtractException.java
index dc6b578..0ae6065 100644
--- a/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/JsonExtractException.java
+++ b/server/protocols/webadmin/webadmin-core/src/main/java/org/apache/james/webadmin/utils/JsonExtractException.java
@@ -22,6 +22,6 @@ package org.apache.james.webadmin.utils;
public class JsonExtractException extends Exception {
public JsonExtractException(Throwable throwable) {
- super(throwable);
+ super(throwable.getMessage(), throwable);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
new file mode 100644
index 0000000..76e2c53
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutes.java
@@ -0,0 +1,50 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.webadmin.routes;
+
+import org.apache.james.webadmin.Routes;
+import org.apache.james.webadmin.utils.JsonExtractor;
+
+import spark.Service;
+
+public class ErrorRoutes implements Routes {
+
+ public static final String BASE_URL = "/errors/";
+ public static final String INTERNAL_SERVER_ERROR = "internalServerError";
+ public static final String JSON_EXTRACT_EXCEPTION = "jsonExtractException";
+
+ @Override
+ public void define(Service service) {
+ defineInternalError(service);
+ defineJsonExtractException(service);
+ }
+
+ private void defineInternalError(Service service) {
+ service.get(BASE_URL + INTERNAL_SERVER_ERROR,
+ (req, res) -> {
+ throw new RuntimeException();
+ });
+ }
+
+ private void defineJsonExtractException(Service service) {
+ service.get(BASE_URL + JSON_EXTRACT_EXCEPTION,
+ (req, res) -> new JsonExtractor<>(Long.class).parse("a non valid JSON"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
new file mode 100644
index 0000000..ffdb07a
--- /dev/null
+++ b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/routes/ErrorRoutesTest.java
@@ -0,0 +1,100 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one *
+ * or more contributor license agreements. See the NOTICE file *
+ * distributed with this work for additional information *
+ * regarding copyright ownership. The ASF licenses this file *
+ * to you under the Apache License, Version 2.0 (the *
+ * "License"); you may not use this file except in compliance *
+ * with the License. You may obtain a copy of the License at *
+ * *
+ * http://www.apache.org/licenses/LICENSE-2.0 *
+ * *
+ * Unless required by applicable law or agreed to in writing, *
+ * software distributed under the License is distributed on an *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
+ * KIND, either express or implied. See the License for the *
+ * specific language governing permissions and limitations *
+ * under the License. *
+ ****************************************************************/
+
+package org.apache.james.webadmin.routes;
+
+import static com.jayway.restassured.RestAssured.when;
+import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
+import static org.apache.james.webadmin.routes.ErrorRoutes.INTERNAL_SERVER_ERROR;
+import static org.apache.james.webadmin.routes.ErrorRoutes.JSON_EXTRACT_EXCEPTION;
+import static org.apache.james.webadmin.utils.ErrorResponder.ErrorType.INVALID_ARGUMENT;
+import static org.apache.james.webadmin.utils.ErrorResponder.ErrorType.SERVER_ERROR;
+import static org.eclipse.jetty.http.HttpStatus.BAD_REQUEST_400;
+import static org.eclipse.jetty.http.HttpStatus.INTERNAL_SERVER_ERROR_500;
+import static org.eclipse.jetty.http.HttpStatus.NOT_FOUND_404;
+import static org.hamcrest.Matchers.equalTo;
+
+import org.apache.james.metrics.api.NoopMetricFactory;
+import org.apache.james.webadmin.WebAdminServer;
+import org.apache.james.webadmin.WebAdminUtils;
+import org.apache.james.webadmin.utils.ErrorResponder;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.jayway.restassured.RestAssured;
+
+public class ErrorRoutesTest {
+ private static final String NOT_FOUND = "notFound";
+
+ private static WebAdminServer webAdminServer;
+
+ @BeforeClass
+ public static void setUp() throws Exception {
+ webAdminServer = WebAdminUtils.createWebAdminServer(
+ new NoopMetricFactory(),
+ new ErrorRoutes());
+ webAdminServer.configure(NO_CONFIGURATION);
+ webAdminServer.await();
+
+ RestAssured.requestSpecification = WebAdminUtils.buildRequestSpecification(webAdminServer)
+ .setBasePath(ErrorRoutes.BASE_URL)
+ .build();
+ RestAssured.enableLoggingOfRequestAndResponseIfValidationFails();
+ }
+
+ @AfterClass
+ public static void tearDown() {
+ webAdminServer.destroy();
+ }
+
+ @Test
+ public void defineInternalErrorShouldReturnInternalErrorJsonFormat() {
+ when()
+ .get(INTERNAL_SERVER_ERROR)
+ .then()
+ .statusCode(INTERNAL_SERVER_ERROR_500)
+ .body("statusCode", equalTo(INTERNAL_SERVER_ERROR_500))
+ .body("type", equalTo(SERVER_ERROR.getType()))
+ .body("message", equalTo("WebAdmin encountered an unexpected internal error"));
+ }
+
+ @Test
+ public void defineNotFoundShouldReturnNotFoundJsonFormat() {
+ when()
+ .get(NOT_FOUND)
+ .then()
+ .statusCode(NOT_FOUND_404)
+ .body("statusCode", equalTo(NOT_FOUND_404))
+ .body("type", equalTo(ErrorResponder.ErrorType.NOT_FOUND.getType()))
+ .body("message", equalTo("GET /errors/notFound can not be found"));
+ }
+
+ @Test
+ public void defineJsonExtractExceptionShouldReturnBadRequestJsonFormat() throws InterruptedException {
+ when()
+ .get(JSON_EXTRACT_EXCEPTION)
+ .then()
+ .statusCode(BAD_REQUEST_400)
+ .body("statusCode", equalTo(BAD_REQUEST_400))
+ .body("type", equalTo(INVALID_ARGUMENT.getType()))
+ .body("message", equalTo("JSON payload of the request is not valid"))
+ .body("details", equalTo("Unrecognized token 'a': was expecting ('true', 'false' or 'null')\n at [Source: a non valid JSON; line: 1, column: 2]"));
+ }
+}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/ErrorResponderTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/ErrorResponderTest.java b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/ErrorResponderTest.java
index 46f2997..53dc91d 100644
--- a/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/ErrorResponderTest.java
+++ b/server/protocols/webadmin/webadmin-core/src/test/java/org/apache/james/webadmin/utils/ErrorResponderTest.java
@@ -134,7 +134,7 @@ public class ErrorResponderTest {
jsonPath.read("$.statusCode"),
jsonPath.read("$.type"),
jsonPath.read("$.message"),
- Optional.ofNullable(jsonPath.read("$.cause"))));
+ Optional.ofNullable(jsonPath.read("$.details"))));
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java
index ea00515..27fc7ab 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/ForwardRoutesTest.java
@@ -24,7 +24,6 @@ import static com.jayway.restassured.RestAssured.with;
import static org.apache.james.webadmin.Constants.SEPARATOR;
import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Matchers.any;
@@ -402,7 +401,7 @@ class ForwardRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The forward is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -421,7 +420,7 @@ class ForwardRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The forward is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -429,8 +428,7 @@ class ForwardRoutesTest {
when()
.put(ALICE_WITH_SLASH + SEPARATOR + "targets" + SEPARATOR + BOB)
.then()
- .statusCode(HttpStatus.NOT_FOUND_404)
- .body(containsString("404 Not found"));
+ .statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
@@ -438,8 +436,7 @@ class ForwardRoutesTest {
when()
.put(ALICE + SEPARATOR + "targets" + SEPARATOR + ALICE_WITH_SLASH)
.then()
- .statusCode(HttpStatus.NOT_FOUND_404)
- .body(containsString("404 Not found"));
+ .statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
@@ -458,7 +455,7 @@ class ForwardRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The forward is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -488,7 +485,7 @@ class ForwardRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The forward is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -507,7 +504,7 @@ class ForwardRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The forward is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -530,8 +527,7 @@ class ForwardRoutesTest {
when()
.put(ALICE + SEPARATOR + "targets" + SEPARATOR + BOB)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -543,8 +539,7 @@ class ForwardRoutesTest {
when()
.put(ALICE + SEPARATOR + "targets" + SEPARATOR + BOB)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -556,8 +551,7 @@ class ForwardRoutesTest {
when()
.put(ALICE + SEPARATOR + "targets" + SEPARATOR + BOB)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -569,8 +563,7 @@ class ForwardRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -582,8 +575,7 @@ class ForwardRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -595,8 +587,7 @@ class ForwardRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -608,8 +599,7 @@ class ForwardRoutesTest {
when()
.delete(ALICE + SEPARATOR + "targets" + SEPARATOR + BOB)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -621,8 +611,7 @@ class ForwardRoutesTest {
when()
.delete(ALICE + SEPARATOR + "targets" + SEPARATOR + BOB)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -634,8 +623,7 @@ class ForwardRoutesTest {
when()
.delete(ALICE + SEPARATOR + "targets" + SEPARATOR + BOB)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -647,8 +635,7 @@ class ForwardRoutesTest {
when()
.get(ALICE)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -660,8 +647,7 @@ class ForwardRoutesTest {
when()
.get(ALICE)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -673,8 +659,7 @@ class ForwardRoutesTest {
when()
.get(ALICE)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
index 8011720..61fb855 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/GroupsRoutesTest.java
@@ -24,7 +24,6 @@ import static com.jayway.restassured.RestAssured.when;
import static org.apache.james.webadmin.Constants.SEPARATOR;
import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
@@ -409,7 +408,7 @@ class GroupsRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The group is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -428,7 +427,7 @@ class GroupsRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The group is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -436,8 +435,7 @@ class GroupsRoutesTest {
when()
.put(GROUP_WITH_SLASH + SEPARATOR + USER_A)
.then()
- .statusCode(HttpStatus.NOT_FOUND_404)
- .body(containsString("404 Not found"));
+ .statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
@@ -445,8 +443,7 @@ class GroupsRoutesTest {
when()
.put(GROUP1 + SEPARATOR + USER_WITH_SLASH)
.then()
- .statusCode(HttpStatus.NOT_FOUND_404)
- .body(containsString("404 Not found"));
+ .statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
@@ -465,7 +462,7 @@ class GroupsRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The group is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -493,7 +490,7 @@ class GroupsRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The group is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -512,7 +509,7 @@ class GroupsRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "The group is not an email address")
- .containsEntry("cause", "Out of data at position 1 in 'not-an-address'");
+ .containsEntry("details", "Out of data at position 1 in 'not-an-address'");
}
@Test
@@ -533,8 +530,7 @@ class GroupsRoutesTest {
when()
.put(GROUP1 + SEPARATOR + GROUP2)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -546,8 +542,7 @@ class GroupsRoutesTest {
when()
.put(GROUP1 + SEPARATOR + GROUP2)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -559,8 +554,7 @@ class GroupsRoutesTest {
when()
.put(GROUP1 + SEPARATOR + GROUP2)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -572,8 +566,7 @@ class GroupsRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -585,8 +578,7 @@ class GroupsRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -598,8 +590,7 @@ class GroupsRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -611,8 +602,7 @@ class GroupsRoutesTest {
when()
.delete(GROUP1 + SEPARATOR + GROUP2)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -624,8 +614,7 @@ class GroupsRoutesTest {
when()
.delete(GROUP1 + SEPARATOR + GROUP2)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -637,8 +626,7 @@ class GroupsRoutesTest {
when()
.delete(GROUP1 + SEPARATOR + GROUP2)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -650,8 +638,7 @@ class GroupsRoutesTest {
when()
.get(GROUP1)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -663,8 +650,7 @@ class GroupsRoutesTest {
when()
.get(GROUP1)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -676,8 +662,7 @@ class GroupsRoutesTest {
when()
.get(GROUP1)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java
index 5c4ae39..1be5ba2 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/DomainQuotaRoutesTest.java
@@ -146,7 +146,7 @@ class DomainQuotaRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "Invalid quota. Need to be an integer value greater or equal to -1")
- .containsEntry("cause", "For input string: \"invalid\"");
+ .containsEntry("details", "For input string: \"invalid\"");
}
@Test
@@ -262,7 +262,7 @@ class DomainQuotaRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "Invalid quota. Need to be an integer value greater or equal to -1")
- .containsEntry("cause", "For input string: \"invalid\"");
+ .containsEntry("details", "For input string: \"invalid\"");
}
@Test
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
index c82cb45..fd81fcf 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/GlobalQuotaRoutesTest.java
@@ -112,7 +112,7 @@ class GlobalQuotaRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "Invalid quota. Need to be an integer value greater or equal to -1")
- .containsEntry("cause", "For input string: \"invalid\""));
+ .containsEntry("details", "For input string: \"invalid\""));
}
@Test
@@ -220,7 +220,7 @@ class GlobalQuotaRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "Invalid quota. Need to be an integer value greater or equal to -1")
- .containsEntry("cause", "For input string: \"invalid\""));
+ .containsEntry("details", "For input string: \"invalid\""));
}
@Test
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
index 68c1cbf..1b457c4 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserMailboxesRoutesTest.java
@@ -25,7 +25,6 @@ import static org.apache.james.webadmin.Constants.SEPARATOR;
import static org.apache.james.webadmin.WebAdminServer.NO_CONFIGURATION;
import static org.apache.james.webadmin.routes.UserMailboxesRoutes.USERS_BASE;
import static org.assertj.core.api.Assertions.assertThat;
-import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.is;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doThrow;
@@ -462,8 +461,7 @@ class UserMailboxesRoutesTest {
when()
.put()
.then()
- .statusCode(HttpStatus.NOT_FOUND_404)
- .body(containsString(HttpStatus.NOT_FOUND_404 + " Not found"));
+ .statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
@@ -471,8 +469,7 @@ class UserMailboxesRoutesTest {
when()
.put(SEPARATOR)
.then()
- .statusCode(HttpStatus.NOT_FOUND_404)
- .body(containsString(HttpStatus.NOT_FOUND_404 + " Not found"));
+ .statusCode(HttpStatus.NOT_FOUND_404);
}
@Test
@@ -747,8 +744,7 @@ class UserMailboxesRoutesTest {
when()
.put(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -758,8 +754,7 @@ class UserMailboxesRoutesTest {
when()
.put(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -785,8 +780,7 @@ class UserMailboxesRoutesTest {
when()
.delete(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -796,8 +790,7 @@ class UserMailboxesRoutesTest {
when()
.delete(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -812,8 +805,7 @@ class UserMailboxesRoutesTest {
when()
.delete(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -823,8 +815,7 @@ class UserMailboxesRoutesTest {
when()
.delete(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -844,8 +835,7 @@ class UserMailboxesRoutesTest {
when()
.delete()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -854,9 +844,8 @@ class UserMailboxesRoutesTest {
when()
.delete()
- .then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .then()
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@@ -872,8 +861,7 @@ class UserMailboxesRoutesTest {
when()
.delete()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -901,8 +889,7 @@ class UserMailboxesRoutesTest {
when()
.delete()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -912,8 +899,7 @@ class UserMailboxesRoutesTest {
when()
.get(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -923,8 +909,7 @@ class UserMailboxesRoutesTest {
when()
.get(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -934,8 +919,7 @@ class UserMailboxesRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -945,8 +929,7 @@ class UserMailboxesRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -956,8 +939,7 @@ class UserMailboxesRoutesTest {
when()
.get()
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -967,8 +949,7 @@ class UserMailboxesRoutesTest {
when()
.get(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -978,8 +959,7 @@ class UserMailboxesRoutesTest {
when()
.put(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -989,8 +969,7 @@ class UserMailboxesRoutesTest {
when()
.delete(MAILBOX_NAME)
.then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
@Test
@@ -999,9 +978,8 @@ class UserMailboxesRoutesTest {
when()
.delete()
- .then()
- .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500)
- .body(containsString("500 Internal Server Error"));
+ .then()
+ .statusCode(HttpStatus.INTERNAL_SERVER_ERROR_500);
}
}
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
index b3c7204..7c4dd85 100644
--- a/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailbox/src/test/java/org/apache/james/webadmin/routes/UserQuotaRoutesTest.java
@@ -191,7 +191,7 @@ class UserQuotaRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "Invalid quota. Need to be an integer value greater or equal to -1")
- .containsEntry("cause", "For input string: \"invalid\"");
+ .containsEntry("details", "For input string: \"invalid\"");
}
@Test
@@ -320,7 +320,7 @@ class UserQuotaRoutesTest {
.containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)
.containsEntry("type", "InvalidArgument")
.containsEntry("message", "Invalid quota. Need to be an integer value greater or equal to -1")
- .containsEntry("cause", "For input string: \"invalid\"");
+ .containsEntry("details", "For input string: \"invalid\"");
}
@Test
http://git-wip-us.apache.org/repos/asf/james-project/blob/99549a88/server/protocols/webadmin/webadmin-mailrepository/src/test/java/org/apache/james/webadmin/routes/MailRepositoriesRoutesTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin/webadmin-mailrepository/src/test/java/org/apache/james/webadmin/routes/MailRepositoriesRoutesTest.java b/server/protocols/webadmin/webadmin-mailrepository/src/test/java/org/apache/james/webadmin/routes/MailRepositoriesRoutesTest.java
index 6bb564b..f3945bb 100644
--- a/server/protocols/webadmin/webadmin-mailrepository/src/test/java/org/apache/james/webadmin/routes/MailRepositoriesRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-mailrepository/src/test/java/org/apache/james/webadmin/routes/MailRepositoriesRoutesTest.java
@@ -240,7 +240,7 @@ public class MailRepositoriesRoutesTest {
.body("statusCode", is(500))
.body("type", is(ErrorResponder.ErrorType.SERVER_ERROR.getType()))
.body("message", is("Error while listing keys"))
- .body("cause", containsString("message"));
+ .body("details", containsString("message"));
}
@Test
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org