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 bt...@apache.org on 2019/11/04 11:24:02 UTC

[james-project] 26/30: JAMES-2958 Small refactoring in DomainMappingRoutesTest

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 79ec2fe1dcc2016b7b0949584d8624c022f02022
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Fri Nov 1 15:04:11 2019 +0700

    JAMES-2958 Small refactoring in DomainMappingRoutesTest
---
 .../webadmin/routes/DomainMappingsRoutesTest.java  | 46 ++++++++++------------
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
index c2c2bce..376a1b1 100644
--- a/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
+++ b/server/protocols/webadmin/webadmin-data/src/test/java/org/apache/james/webadmin/routes/DomainMappingsRoutesTest.java
@@ -28,7 +28,6 @@ import static org.apache.james.webadmin.routes.DomainMappingsRoutes.DOMAIN_MAPPI
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.entry;
 import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.Matchers.isEmptyString;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
@@ -108,8 +107,7 @@ class DomainMappingsRoutesTest {
             .when()
                 .put("from.com")
             .then()
-                .statusCode(HttpStatus.NO_CONTENT_204)
-                .body(isEmptyString());
+                .statusCode(HttpStatus.NO_CONTENT_204);
         }
 
         @Test
@@ -123,8 +121,7 @@ class DomainMappingsRoutesTest {
             .when()
                 .put("from.com")
             .then()
-                .statusCode(HttpStatus.NO_CONTENT_204)
-                .body(isEmptyString());
+                .statusCode(HttpStatus.NO_CONTENT_204);
         }
 
         @Test
@@ -219,8 +216,7 @@ class DomainMappingsRoutesTest {
             .when()
                 .delete("from.com")
             .then()
-                .statusCode(HttpStatus.NO_CONTENT_204)
-                .body(isEmptyString());
+                .statusCode(HttpStatus.NO_CONTENT_204);
         }
 
         @Test
@@ -237,7 +233,7 @@ class DomainMappingsRoutesTest {
             .when()
                 .delete("from.com")
             .then()
-                .body(isEmptyString());
+                .statusCode(HttpStatus.NO_CONTENT_204);
 
             assertThat(recipientRewriteTable.getAllMappings()).isEmpty();
         }
@@ -308,14 +304,14 @@ class DomainMappingsRoutesTest {
             when(recipientRewriteTable.getStoredMappings(any())).thenReturn(mappings);
 
             List<String> body =
-            when()
-                .get(domain)
-            .then()
-                .contentType(ContentType.JSON)
-                .statusCode(HttpStatus.OK_200)
-                .extract()
-                .jsonPath()
-                .getList(".");
+                when()
+                    .get(domain)
+                .then()
+                    .contentType(ContentType.JSON)
+                    .statusCode(HttpStatus.OK_200)
+                    .extract()
+                    .jsonPath()
+                    .getList(".");
 
             assertThat(body).contains(aliasDomain);
         }
@@ -390,15 +386,15 @@ class DomainMappingsRoutesTest {
         @Test
         void addSpecificDomainMappingWithInvalidDomainInPath() {
             Map<String, Object> errors =
-            when()
-                .get("abc@domain.com")
-            .then()
-                .statusCode(HttpStatus.BAD_REQUEST_400)
-                .contentType(ContentType.JSON)
-            .extract()
-                .body()
-                .jsonPath()
-                .getMap(".");
+                when()
+                    .get("abc@domain.com")
+                .then()
+                    .statusCode(HttpStatus.BAD_REQUEST_400)
+                    .contentType(ContentType.JSON)
+                .extract()
+                    .body()
+                    .jsonPath()
+                    .getMap(".");
 
             assertThat(errors)
                 .containsEntry("statusCode", HttpStatus.BAD_REQUEST_400)


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org