From 3cda243a03b30a4947e553e0c4d8ed22699fe6ed Mon Sep 17 00:00:00 2001 From: Ian Allen Date: Mon, 30 Oct 2023 07:58:18 -0300 Subject: [PATCH] Fix other exceptions in tests related to (#6977) --- .../test/java/org/fao/geonet/api/csw/VirtualCswApiTest.java | 2 +- .../test/java/org/fao/geonet/api/groups/GroupsApiTest.java | 4 ++-- .../org/fao/geonet/api/records/MetadataValidateApiTest.java | 2 +- .../src/test/java/org/fao/geonet/api/users/UsersApiTest.java | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/services/src/test/java/org/fao/geonet/api/csw/VirtualCswApiTest.java b/services/src/test/java/org/fao/geonet/api/csw/VirtualCswApiTest.java index 6c531fb11b3..500962feca2 100644 --- a/services/src/test/java/org/fao/geonet/api/csw/VirtualCswApiTest.java +++ b/services/src/test/java/org/fao/geonet/api/csw/VirtualCswApiTest.java @@ -177,7 +177,7 @@ public void addExistingService() throws Exception { .session(this.mockHttpSession) .accept(MediaType.parseMediaType("application/json"))) .andExpect(status().is(400)) - .andExpect(jsonPath("$.description", is("A service already exist with this name 'csw-endpoint1'. Choose another name."))); + .andExpect(jsonPath("$.message", is("A service already exist with this name 'csw-endpoint1'. Choose another name."))); } @Test diff --git a/services/src/test/java/org/fao/geonet/api/groups/GroupsApiTest.java b/services/src/test/java/org/fao/geonet/api/groups/GroupsApiTest.java index 3bd300faf70..339906ae504 100644 --- a/services/src/test/java/org/fao/geonet/api/groups/GroupsApiTest.java +++ b/services/src/test/java/org/fao/geonet/api/groups/GroupsApiTest.java @@ -256,7 +256,7 @@ public void updateInvalidNameGroup() throws Exception { } }) .andExpect(status().is(400)) - .andExpect(jsonPath("$.description", is("Group name may only contain alphanumeric " + .andExpect(jsonPath("$.message", is("Group name may only contain alphanumeric " + "characters or single hyphens. Cannot begin or end with a hyphen."))); } } @@ -364,7 +364,7 @@ public void addGroupInvalidName() throws Exception { } }) .andExpect(status().is(400)) - .andExpect(jsonPath("$.description", is("Group name may only contain alphanumeric " + .andExpect(jsonPath("$.message", is("Group name may only contain alphanumeric " + "characters or single hyphens. Cannot begin or end with a hyphen."))); } } diff --git a/services/src/test/java/org/fao/geonet/api/records/MetadataValidateApiTest.java b/services/src/test/java/org/fao/geonet/api/records/MetadataValidateApiTest.java index 3f0a4230ac7..88b8d7c3f32 100644 --- a/services/src/test/java/org/fao/geonet/api/records/MetadataValidateApiTest.java +++ b/services/src/test/java/org/fao/geonet/api/records/MetadataValidateApiTest.java @@ -135,7 +135,7 @@ public void subTemplateValidIsTrueButNotLoggedAsAdmin() throws Exception { .accept(MediaType.APPLICATION_JSON)) .andExpect(status().is4xxClientError()) .andExpect(content().contentType(API_JSON_EXPECTED_ENCODING)) - .andExpect(jsonPath("$.message").value("SecurityException")); + .andExpect(jsonPath("$.message").value("User anonymous can't edit record with UUID " + subTemplate.getUuid())); List validations = metadataValidationRepository.findAllById_MetadataId(subTemplate.getId()); assertEquals(0, validations.size()); diff --git a/services/src/test/java/org/fao/geonet/api/users/UsersApiTest.java b/services/src/test/java/org/fao/geonet/api/users/UsersApiTest.java index 40ddd848a00..f17c90c3a33 100644 --- a/services/src/test/java/org/fao/geonet/api/users/UsersApiTest.java +++ b/services/src/test/java/org/fao/geonet/api/users/UsersApiTest.java @@ -363,7 +363,7 @@ public void createUserInvalidUsername() throws Exception { System.err.println(invalidName + " has been accepted as user name and it shouldn't"); } }) - .andExpect(jsonPath("$.description", is("username may only contain alphanumeric " + .andExpect(jsonPath("$.message", is("username may only contain alphanumeric " + "characters or single hyphens, single at signs or single dots. Cannot begin or end with a " + "hyphen, at sign or dot."))) .andExpect(status().is(400)); @@ -608,7 +608,7 @@ public void updateUserInvalidUsername() throws Exception { } }) .andExpect(status().is(400)) - .andExpect(jsonPath("$.description", is("username may only contain alphanumeric " + .andExpect(jsonPath("$.message", is("username may only contain alphanumeric " + "characters or single hyphens, single at signs or single dots. Cannot begin or end with a " + "hyphen, at sign or dot."))); }