From 0cc33e6f1ccb84b0dbbf8b8a8e22ad7b0c0f13da Mon Sep 17 00:00:00 2001 From: mionescu Date: Thu, 2 Mar 2017 15:36:05 +0200 Subject: [PATCH] test- define new constant in RestErrorModel, updated tests --- .../org/alfresco/rest/comments/AddCommentsFullTests.java | 8 ++++---- .../org/alfresco/rest/comments/GetCommentsFullTests.java | 8 ++++---- .../rest/workflow/processes/DeleteProcessFullTests.java | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/e2e-test/java/org/alfresco/rest/comments/AddCommentsFullTests.java b/e2e-test/java/org/alfresco/rest/comments/AddCommentsFullTests.java index 58cd1f92a..91d4b8153 100644 --- a/e2e-test/java/org/alfresco/rest/comments/AddCommentsFullTests.java +++ b/e2e-test/java/org/alfresco/rest/comments/AddCommentsFullTests.java @@ -154,9 +154,9 @@ public class AddCommentsFullTests extends RestTest restClient.processModel(RestCommentModel.class, request); restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST); - restClient.assertLastError().getErrorKey().contains("Unrecognized field \"content2\""); - restClient.assertLastError().containsSummary("Unrecognized field \"content2\""); - restClient.assertLastError().getDescriptionURL().contains("https://api-explorer.alfresco.com"); - restClient.assertLastError().getStackTrace().contains("For security reasons the stack trace is no longer displayed, but the property is kept for previous versions"); + restClient.assertLastError().containsErrorKey(String.format(RestErrorModel.UNRECOGNIZED_FIELD, "content2")); + restClient.assertLastError().containsSummary(String.format(RestErrorModel.UNRECOGNIZED_FIELD, "content2")); + restClient.assertLastError().descriptionURLIs(RestErrorModel.RESTAPIEXPLORER); + restClient.assertLastError().stackTraceIs(RestErrorModel.STACKTRACE); } } diff --git a/e2e-test/java/org/alfresco/rest/comments/GetCommentsFullTests.java b/e2e-test/java/org/alfresco/rest/comments/GetCommentsFullTests.java index b7021f602..cf0e38b9f 100644 --- a/e2e-test/java/org/alfresco/rest/comments/GetCommentsFullTests.java +++ b/e2e-test/java/org/alfresco/rest/comments/GetCommentsFullTests.java @@ -207,9 +207,9 @@ public class GetCommentsFullTests extends RestTest restClient.authenticateUser(adminUserModel).withCoreAPI().usingResource(file).usingParams("maxItems=0").getNodeComments(); restClient.assertStatusCodeIs(HttpStatus.BAD_REQUEST).assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS); - restClient.assertLastError().getErrorKey().contains("Only positive values supported for maxItems."); - restClient.assertLastError().containsSummary("Only positive values supported for maxItems."); - restClient.assertLastError().getDescriptionURL().contains("https://api-explorer.alfresco.com"); - restClient.assertLastError().getStackTrace().contains("For security reasons the stack trace is no longer displayed, but the property is kept for previous versions"); + restClient.assertLastError().containsErrorKey(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS); + restClient.assertLastError().containsSummary(RestErrorModel.ONLY_POSITIVE_VALUES_MAXITEMS); + restClient.assertLastError().descriptionURLIs(RestErrorModel.RESTAPIEXPLORER); + restClient.assertLastError().stackTraceIs(RestErrorModel.STACKTRACE); } } \ No newline at end of file diff --git a/e2e-test/java/org/alfresco/rest/workflow/processes/DeleteProcessFullTests.java b/e2e-test/java/org/alfresco/rest/workflow/processes/DeleteProcessFullTests.java index 9463d812b..3487bd5f8 100644 --- a/e2e-test/java/org/alfresco/rest/workflow/processes/DeleteProcessFullTests.java +++ b/e2e-test/java/org/alfresco/rest/workflow/processes/DeleteProcessFullTests.java @@ -43,7 +43,7 @@ public class DeleteProcessFullTests extends RestTest restClient.withWorkflowAPI().usingProcess(process).deleteProcess(); restClient.assertStatusCodeIs(HttpStatus.NOT_FOUND).assertLastError() .containsErrorKey(RestErrorModel.ENTITY_NOT_FOUND_ERRORKEY) - .containsSummary(String.format("%s: %s ", "The entity with id" , process.getId(), RestErrorModel.ENTITY_NOT_FOUND)) + .containsSummary(String.format(RestErrorModel.ENTITY_WAS_NOT_FOUND, process.getId())) .descriptionURLIs(RestErrorModel.RESTAPIEXPLORER) .stackTraceIs(RestErrorModel.STACKTRACE);