diff --git a/README.md b/README.md index 92e2cd31..0f2dda95 100644 --- a/README.md +++ b/README.md @@ -213,6 +213,7 @@ The service can also be adapted using the yaml files found in the following loca - [src/main/resources/application-dev.yaml](./src/main/resources/application-dev.yaml) for changes to the behaviour of the service when running locally. - [src/test/resources/application-test.yaml](./src/test/resources/application-test.yaml) for changes to other test types (e.g. unit tests). - [src/integrationTest/resources/application-integration.yaml](./src/integrationTest/resources/application-integration.yaml) for changes to the application when it's running integration tests. +- [src/integrationTest/resources/application-integration-jpa.yaml](./src/integrationTest/resources/application-integration-jpa.yaml) for changes to the application when it's running repository integration tests. - [src/integrationTest/resources/application-functional.yaml](./src/functionalTest/resources/application-functional.yaml) for changes to the application when its running functional tests. ### Fortify diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/AuditRepositoryTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/AuditRepositoryTest.java new file mode 100644 index 00000000..b1560725 --- /dev/null +++ b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/AuditRepositoryTest.java @@ -0,0 +1,91 @@ +package uk.gov.hmcts.reform.pip.account.management.database; + +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.data.jpa.repository.config.EnableJpaAuditing; +import org.springframework.test.context.ActiveProfiles; +import uk.gov.hmcts.reform.pip.account.management.model.AuditLog; +import uk.gov.hmcts.reform.pip.model.account.Roles; +import uk.gov.hmcts.reform.pip.model.account.UserProvenances; +import uk.gov.hmcts.reform.pip.model.enums.AuditAction; + +import java.time.LocalDateTime; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +@ActiveProfiles("integration-jpa") +@DataJpaTest +@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) +@EnableJpaAuditing +class AuditRepositoryTest { + private static final String USER_ID1 = "123"; + private static final String USER_ID2 = "124"; + private static final String USER_ID3 = "125"; + private static final String EMAIL1 = "TestUser1@justice.gov.uk"; + private static final String EMAIL2 = "TestUser2@justice.gov.uk"; + private static final String EMAIL3 = "TestUser3@justice.gov.uk"; + private static final String DETAILS1 = "Details 1"; + private static final String DETAILS2 = "Details 2"; + private static final String DETAILS3 = "Details 3"; + + private static final String AUDIT_LOG_MATCHED_MESSAGE = "Audit log does not match"; + private static final String AUDIT_LOG_EMPTY_MESSAGE = "Audit log is not empty"; + + @Autowired + AuditRepository auditRepository; + + @BeforeEach + void setup() { + AuditLog auditLog1 = new AuditLog(); + auditLog1.setUserId(USER_ID1); + auditLog1.setUserEmail(EMAIL1); + auditLog1.setRoles(Roles.SYSTEM_ADMIN); + auditLog1.setUserProvenance(UserProvenances.SSO); + auditLog1.setAction(AuditAction.MANAGE_USER); + auditLog1.setDetails(DETAILS1); + + AuditLog auditLog2 = new AuditLog(); + auditLog2.setUserId(USER_ID2); + auditLog2.setUserEmail(EMAIL2); + auditLog2.setRoles(Roles.INTERNAL_ADMIN_CTSC); + auditLog2.setUserProvenance(UserProvenances.SSO); + auditLog2.setAction(AuditAction.REFERENCE_DATA_UPLOAD); + auditLog2.setDetails(DETAILS2); + + AuditLog auditLog3 = new AuditLog(); + auditLog3.setUserId(USER_ID3); + auditLog3.setUserEmail(EMAIL3); + auditLog3.setRoles(Roles.INTERNAL_ADMIN_LOCAL); + auditLog3.setUserProvenance(UserProvenances.SSO); + auditLog3.setAction(AuditAction.DELETE_PUBLICATION); + auditLog3.setDetails(DETAILS3); + + auditRepository.saveAll(List.of(auditLog1, auditLog2, auditLog3)); + } + + @AfterEach + void shutdown() { + auditRepository.deleteAll(); + } + + @Test + void shouldDeleteAllByTimestampBefore() { + auditRepository.deleteAllByTimestampBefore(LocalDateTime.now().plusMinutes(10)); + assertThat(auditRepository.findAll()) + .as(AUDIT_LOG_EMPTY_MESSAGE) + .isEmpty(); + } + + @Test + void shouldNotDeleteAllByTimestamp() { + auditRepository.deleteAllByTimestampBefore(LocalDateTime.now().minusMinutes(10)); + assertThat(auditRepository.findAll()) + .as(AUDIT_LOG_MATCHED_MESSAGE) + .hasSize(3); + } +} diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/MediaApplicationRepositoryTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/MediaApplicationRepositoryTest.java new file mode 100644 index 00000000..e3d1440f --- /dev/null +++ b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/MediaApplicationRepositoryTest.java @@ -0,0 +1,90 @@ +package uk.gov.hmcts.reform.pip.account.management.database; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.test.context.ActiveProfiles; +import uk.gov.hmcts.reform.pip.account.management.model.MediaApplication; +import uk.gov.hmcts.reform.pip.account.management.model.MediaApplicationStatus; + +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +@ActiveProfiles("integration-jpa") +@DataJpaTest +@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class MediaApplicationRepositoryTest { + private static final String NAME1 = "Test name 1"; + private static final String NAME2 = "Test name 2"; + private static final String NAME3 = "Test name 3"; + private static final String NAME4 = "Test name 4"; + private static final String EMAIL1 = "TestUser1@justice.gov.uk"; + private static final String EMAIL2 = "TestUser2@justice.gov.uk"; + private static final String EMAIL3 = "testuser3@justice.gov.uk"; + private static final String EMAIL4 = "AnotherTestUser@justice.gov.uk"; + private static final String EMPLOYER = "Test Employer"; + + private static final String MEDIA_APPLICATION_MATCHED_MESSAGE = "Media application does not match"; + private static final String MEDIA_APPLICATION_EMPTY_MESSAGE = "Media application is not empty"; + + @Autowired + MediaApplicationRepository mediaApplicationRepository; + + @BeforeAll + void setup() { + MediaApplication mediaApplication1 = new MediaApplication(); + mediaApplication1.setFullName(NAME1); + mediaApplication1.setEmail(EMAIL1); + mediaApplication1.setEmployer(EMPLOYER); + mediaApplication1.setStatus(MediaApplicationStatus.PENDING); + + MediaApplication mediaApplication2 = new MediaApplication(); + mediaApplication2.setFullName(NAME2); + mediaApplication2.setEmail(EMAIL2); + mediaApplication2.setEmployer(EMPLOYER); + mediaApplication2.setStatus(MediaApplicationStatus.APPROVED); + + MediaApplication mediaApplication3 = new MediaApplication(); + mediaApplication3.setFullName(NAME3); + mediaApplication3.setEmail(EMAIL3); + mediaApplication3.setEmployer(EMPLOYER); + mediaApplication3.setStatus(MediaApplicationStatus.REJECTED); + + MediaApplication mediaApplication4 = new MediaApplication(); + mediaApplication4.setFullName(NAME4); + mediaApplication4.setEmail(EMAIL4); + mediaApplication4.setEmployer(EMPLOYER); + mediaApplication4.setStatus(MediaApplicationStatus.PENDING); + + mediaApplicationRepository.saveAll( + List.of(mediaApplication1, mediaApplication2, mediaApplication3, mediaApplication4) + ); + } + + @AfterAll + void shutdown() { + mediaApplicationRepository.deleteAll(); + } + + @Test + void shouldFindAllMediaApplicationsByEmailStartingWithPrefix() { + assertThat(mediaApplicationRepository.findAllByEmailStartingWithIgnoreCase("testUser")) + .as(MEDIA_APPLICATION_MATCHED_MESSAGE) + .hasSize(3) + .extracting(MediaApplication::getEmail) + .containsExactlyInAnyOrder(EMAIL1, EMAIL2, EMAIL3); + } + + @Test + void shouldFindAllMediaApplicationsByEmailIfPrefixNotMatched() { + assertThat(mediaApplicationRepository.findAllByEmailStartingWithIgnoreCase("InvalidPrefix")) + .as(MEDIA_APPLICATION_EMPTY_MESSAGE) + .isEmpty(); + } +} diff --git a/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/UserRepositoryTest.java b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/UserRepositoryTest.java new file mode 100644 index 00000000..0441fa23 --- /dev/null +++ b/src/integrationTest/java/uk/gov/hmcts/reform/pip/account/management/database/UserRepositoryTest.java @@ -0,0 +1,165 @@ +package uk.gov.hmcts.reform.pip.account.management.database; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestInstance; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.jdbc.AutoConfigureTestDatabase; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.domain.Pageable; +import org.springframework.test.context.ActiveProfiles; +import uk.gov.hmcts.reform.pip.account.management.model.PiUser; +import uk.gov.hmcts.reform.pip.model.account.Roles; +import uk.gov.hmcts.reform.pip.model.account.UserProvenances; + +import java.time.LocalDateTime; +import java.util.UUID; + +import static org.assertj.core.api.Assertions.assertThat; + +@ActiveProfiles("integration-jpa") +@DataJpaTest +@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE) +@TestInstance(TestInstance.Lifecycle.PER_CLASS) +class UserRepositoryTest { + private static final String PROVENANCE_USER_ID1 = UUID.randomUUID().toString(); + private static final String PROVENANCE_USER_ID2 = UUID.randomUUID().toString(); + private static final String PROVENANCE_USER_ID3 = UUID.randomUUID().toString(); + private static final String PROVENANCE_USER_ID4 = UUID.randomUUID().toString(); + private static final String PROVENANCE_USER_ID5 = UUID.randomUUID().toString(); + private static final String EMAIL1 = "TestUser1@justice.gov.uk"; + private static final String EMAIL2 = "TestUser2@justice.gov.uk"; + private static final String EMAIL3 = "TestUser3@justice.gov.uk"; + private static final String EMAIL4 = "TestUser4@justice.gov.uk"; + private static final String EMAIL5 = "TestUser5@justice.gov.uk"; + + private static final LocalDateTime TIMESTAMP_NOW = LocalDateTime.now(); + private static final int DAYS = 5; + + private static final String USER_MATCHED_MESSAGE = "User does not match"; + private static final String USER_EMPTY_MESSAGE = "User is not empty"; + + private UUID userId1; + private UUID userId2; + private UUID userId3; + private UUID userId4; + private UUID userId5; + + @Autowired + UserRepository userRepository; + + @BeforeAll + void setup() { + PiUser user1 = new PiUser(); + user1.setEmail(EMAIL1); + user1.setProvenanceUserId(PROVENANCE_USER_ID1); + user1.setUserProvenance(UserProvenances.PI_AAD); + user1.setRoles(Roles.VERIFIED); + user1.setLastVerifiedDate(TIMESTAMP_NOW.minusDays(DAYS)); + userId1 = userRepository.save(user1).getUserId(); + + PiUser user2 = new PiUser(); + user2.setEmail(EMAIL2); + user2.setProvenanceUserId(PROVENANCE_USER_ID2); + user2.setUserProvenance(UserProvenances.PI_AAD); + user2.setRoles(Roles.INTERNAL_ADMIN_CTSC); + user2.setLastSignedInDate(TIMESTAMP_NOW.minusDays(DAYS)); + userId2 = userRepository.save(user2).getUserId(); + + PiUser user3 = new PiUser(); + user3.setEmail(EMAIL3); + user3.setProvenanceUserId(PROVENANCE_USER_ID3); + user3.setUserProvenance(UserProvenances.SSO); + user3.setRoles(Roles.INTERNAL_ADMIN_CTSC); + user3.setLastSignedInDate(TIMESTAMP_NOW.minusDays(DAYS)); + userId3 = userRepository.save(user3).getUserId(); + + PiUser user4 = new PiUser(); + user4.setEmail(EMAIL4); + user4.setProvenanceUserId(PROVENANCE_USER_ID4); + user4.setUserProvenance(UserProvenances.CFT_IDAM); + user4.setRoles(Roles.VERIFIED); + user4.setLastSignedInDate(TIMESTAMP_NOW.minusDays(DAYS)); + userId4 = userRepository.save(user4).getUserId(); + + PiUser user5 = new PiUser(); + user5.setEmail(EMAIL5); + user5.setProvenanceUserId(PROVENANCE_USER_ID5); + user5.setUserProvenance(UserProvenances.CRIME_IDAM); + user5.setRoles(Roles.VERIFIED); + user5.setLastSignedInDate(TIMESTAMP_NOW.minusDays(DAYS)); + userId5 = userRepository.save(user5).getUserId(); + } + + @AfterAll + void shutdown() { + userRepository.deleteAll(); + } + + @Test + void shouldFindUserByProvenanceId() { + assertThat(userRepository.findExistingByProvenanceId(PROVENANCE_USER_ID1, UserProvenances.PI_AAD.name())) + .as(USER_MATCHED_MESSAGE) + .hasSize(1) + .extracting(PiUser::getUserId) + .containsExactly(userId1); + } + + @Test + void shouldNotFindUserByProvenanceIdIfUserProvenanceMismatch() { + assertThat(userRepository.findExistingByProvenanceId(PROVENANCE_USER_ID1, UserProvenances.CFT_IDAM.name())) + .as(USER_EMPTY_MESSAGE) + .isEmpty(); + } + + @Test + void shouldFindVerifiedUsersByLastVerifiedDate() { + assertThat(userRepository.findVerifiedUsersByLastVerifiedDate(DAYS)) + .as(USER_MATCHED_MESSAGE) + .hasSize(1) + .extracting(PiUser::getUserId) + .containsExactly(userId1); + } + + @Test + void shouldFindAdminUsersFortNotificationByLastSignedInDate() { + assertThat(userRepository.findAdminUsersFortNotificationByLastSignedInDate(DAYS)) + .as(USER_MATCHED_MESSAGE) + .hasSize(1) + .extracting(PiUser::getUserId) + .containsExactly(userId2); + } + + @Test + void shouldFindAdminUsersForDeletionByLastSignedInDate() { + assertThat(userRepository.findAdminUsersForDeletionByLastSignedInDate(DAYS, DAYS)) + .as(USER_MATCHED_MESSAGE) + .hasSize(2) + .extracting(PiUser::getUserId) + .containsExactlyInAnyOrder(userId2, userId3); + } + + @Test + void shouldFindIdamUsersByLastSignedInDate() { + assertThat(userRepository.findIdamUsersByLastSignedInDate(DAYS, DAYS)) + .as(USER_MATCHED_MESSAGE) + .hasSize(2) + .extracting(PiUser::getUserId) + .containsExactlyInAnyOrder(userId4, userId5); + } + + @Test + void shouldFindByUserIdPageable() { + Pageable pageable = PageRequest.of(0, 25); + Page page = userRepository.findByUserIdPageable(userId1.toString(), pageable); + + assertThat(page.getContent()) + .hasSize(1) + .first() + .extracting(PiUser::getUserId) + .isEqualTo(userId1); + } +} diff --git a/src/integrationTest/resources/application-integration-jpa.yaml b/src/integrationTest/resources/application-integration-jpa.yaml new file mode 100644 index 00000000..deead080 --- /dev/null +++ b/src/integrationTest/resources/application-integration-jpa.yaml @@ -0,0 +1,9 @@ +spring: + datasource: + driver-class-name: org.testcontainers.jdbc.ContainerDatabaseDriver + url: jdbc:tc:postgresql://localhost/pip + jpa: + hibernate: + ddl-auto: create + flyway: + enabled: true diff --git a/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureBlobConfiguration.java b/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureBlobConfiguration.java index c0e5c916..3adfb0d4 100644 --- a/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureBlobConfiguration.java +++ b/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureBlobConfiguration.java @@ -15,7 +15,7 @@ import java.util.Arrays; @Configuration -@Profile("!test & !integration & !functional") +@Profile("!test & !integration & !integration-jpa & !functional") public class AzureBlobConfiguration { private static final String BLOB_ENDPOINT = "https://%s.blob.core.windows.net/"; private static final String DEV_PROFILE = "blobStorageDev"; diff --git a/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureConfigurationClient.java b/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureConfigurationClient.java index 228a3f4e..c4ae79fe 100644 --- a/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureConfigurationClient.java +++ b/src/main/java/uk/gov/hmcts/reform/pip/account/management/config/AzureConfigurationClient.java @@ -10,7 +10,7 @@ /** * Configuration class used to initialise beans to talk to Azure graph. */ -@Profile("!test & !integration & !functional") +@Profile("!test & !integration & !integration-jpa & !functional") @Configuration public class AzureConfigurationClient { diff --git a/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/PublicationServiceTest.java b/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/PublicationServiceTest.java index d73f9603..95982997 100644 --- a/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/PublicationServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/PublicationServiceTest.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.pip.account.management.service; -import io.zonky.test.db.AutoConfigureEmbeddedDatabase; import nl.altindag.log.LogCaptor; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; @@ -9,11 +8,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; -import uk.gov.hmcts.reform.pip.account.management.Application; -import uk.gov.hmcts.reform.pip.account.management.config.AzureConfigurationClientTestConfiguration; +import org.springframework.web.reactive.function.client.WebClient; import uk.gov.hmcts.reform.pip.account.management.model.MediaApplication; import uk.gov.hmcts.reform.pip.account.management.model.MediaApplicationStatus; import uk.gov.hmcts.reform.pip.model.account.UserProvenances; @@ -32,13 +28,11 @@ import static uk.gov.hmcts.reform.pip.account.management.helper.MediaApplicationHelper.createApplicationList; @ExtendWith(MockitoExtension.class) -@SpringBootTest(classes = {AzureConfigurationClientTestConfiguration.class, Application.class}) @ActiveProfiles({"test", "non-async"}) -@AutoConfigureEmbeddedDatabase(type = AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES) @SuppressWarnings({"PMD.TooManyMethods"}) class PublicationServiceTest { - private static MockWebServer mockPublicationServicesEndpoint; + private final MockWebServer mockPublicationServicesEndpoint = new MockWebServer(); private static final String SENT_MESSAGE = "test email sent"; private static final String EMAIL = "test@email.com"; @@ -47,15 +41,20 @@ class PublicationServiceTest { private static final String ERROR_LOG_EMPTY_MESSAGE = "Error log is not empty"; private static final String ERROR_LOG_MATCH_MESSAGE = "Error log does not match"; - @Autowired PublicationService publicationService; LogCaptor logCaptor = LogCaptor.forClass(PublicationService.class); @BeforeEach void setup() throws IOException { - mockPublicationServicesEndpoint = new MockWebServer(); mockPublicationServicesEndpoint.start(8081); + + WebClient mockedWebClient = + WebClient.builder() + .baseUrl(mockPublicationServicesEndpoint.url("/").toString()) + .build(); + + publicationService = new PublicationService(mockedWebClient); } @AfterEach diff --git a/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/SubscriptionServiceTest.java b/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/SubscriptionServiceTest.java index 1ec7e5ff..2e739420 100644 --- a/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/SubscriptionServiceTest.java +++ b/src/test/java/uk/gov/hmcts/reform/pip/account/management/service/SubscriptionServiceTest.java @@ -1,6 +1,5 @@ package uk.gov.hmcts.reform.pip.account.management.service; -import io.zonky.test.db.AutoConfigureEmbeddedDatabase; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.jupiter.api.AfterEach; @@ -8,11 +7,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.junit.jupiter.MockitoExtension; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; -import uk.gov.hmcts.reform.pip.account.management.Application; -import uk.gov.hmcts.reform.pip.account.management.config.AzureConfigurationClientTestConfiguration; +import org.springframework.web.reactive.function.client.WebClient; import java.io.IOException; @@ -20,22 +16,25 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @ExtendWith(MockitoExtension.class) -@SpringBootTest(classes = {AzureConfigurationClientTestConfiguration.class, Application.class}) @ActiveProfiles({"test", "non-async"}) -@AutoConfigureEmbeddedDatabase(type = AutoConfigureEmbeddedDatabase.DatabaseType.POSTGRES) class SubscriptionServiceTest { - private static MockWebServer mockSubscriptionManagementEndpoint; + private final MockWebServer mockSubscriptionManagementEndpoint = new MockWebServer(); - @Autowired SubscriptionService subscriptionService; private static final String TEST_RESPONSE_STRING = "All subscriptions for user deleted"; @BeforeEach void setup() throws IOException { - mockSubscriptionManagementEndpoint = new MockWebServer(); mockSubscriptionManagementEndpoint.start(4550); + + WebClient mockedWebClient = + WebClient.builder() + .baseUrl(mockSubscriptionManagementEndpoint.url("/").toString()) + .build(); + + subscriptionService = new SubscriptionService(mockedWebClient); } @AfterEach