From 0cfd0a1e0be1dc46732745aacefdd15411d2bd2c Mon Sep 17 00:00:00 2001 From: ChrisS1512 <87066931+ChrisS1512@users.noreply.github.com> Date: Fri, 13 Dec 2024 11:15:22 +0000 Subject: [PATCH] PUB-2681 - Fixed PMD issue --- .../account/management/controllers/AccountTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/controllers/AccountTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/controllers/AccountTest.java index 701ab8ea..100c98ee 100644 --- a/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/controllers/AccountTest.java +++ b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/controllers/AccountTest.java @@ -119,6 +119,7 @@ class AccountTest { private static final String FORBIDDEN_STATUS_CODE = "Status code does not match forbidden"; private static final String DELETE_USER_FAILURE = "Failed to delete user account"; private static final String DELETE_USER_SUCCESS = "User deleted"; + private static final String ADD_USERS_SCRIPT = "classpath:add-admin-users.sql"; private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); @@ -610,7 +611,7 @@ void testDeleteAccountNotFound() throws Exception { } @Test - @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:add-admin-users.sql") + @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = ADD_USERS_SCRIPT) void testV2SystemAdminDeletesVerifiedUser() throws Exception { validUser.setUserProvenance(UserProvenances.CFT_IDAM); validUser.setRoles(Roles.VERIFIED); @@ -644,7 +645,7 @@ void testV2SystemAdminDeletesVerifiedUser() throws Exception { } @Test - @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:add-admin-users.sql") + @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = ADD_USERS_SCRIPT) void testV2SystemAdminDeletesThirdPartyUser() throws Exception { PiUser thirdPartyUser = createThirdPartyUser(); @@ -676,7 +677,7 @@ void testV2SystemAdminDeletesThirdPartyUser() throws Exception { } @Test - @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:add-admin-users.sql") + @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = ADD_USERS_SCRIPT) void testV2SystemAdminDeletesSuperAdminUser() throws Exception { superAdminUser.setUserProvenance(UserProvenances.CFT_IDAM); String superAdminUserId = getSuperAdminUserId(superAdminUser); @@ -897,7 +898,7 @@ void testUpdateAccountRoleByIdNotFound() throws Exception { } @Test - @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:add-admin-users.sql") + @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = ADD_USERS_SCRIPT) void testCreateThirdPartyUser() throws Exception { PiUser thirdPartyUser = createThirdPartyUser(); MockHttpServletRequestBuilder mockHttpServletRequestBuilder = MockMvcRequestBuilders @@ -920,7 +921,7 @@ void testCreateThirdPartyUser() throws Exception { } @Test - @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = "classpath:add-admin-users.sql") + @Sql(executionPhase = Sql.ExecutionPhase.BEFORE_TEST_METHOD, scripts = ADD_USERS_SCRIPT) void testUnauthorizedCreateThirdPartyUser() throws Exception { PiUser thirdPartyUser = createUser(true, Roles.GENERAL_THIRD_PARTY); MockHttpServletRequestBuilder mockHttpServletRequestBuilder = MockMvcRequestBuilders