From 8cf70165f4999929135289627f12b0b7141ecb98 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Jan 2025 10:43:31 -0500 Subject: [PATCH] fix(deps): bump org.openapitools:openapi-generator-maven-plugin from 7.9.0 to 7.11.0 (#95) * fix(deps): bump org.openapitools:openapi-generator-maven-plugin Bumps org.openapitools:openapi-generator-maven-plugin from 7.9.0 to 7.11.0. --- updated-dependencies: - dependency-name: org.openapitools:openapi-generator-maven-plugin dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] * fix changed enum values * fix sonar violations --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: PBobylev --- pom.xml | 12 ++- .../SourceRecordDomainEventHandler.java | 11 +-- .../linked/data/e2e/ProfileControllerIT.java | 4 +- .../data/e2e/database/DatabaseITBase.java | 4 +- .../dictionary/PredicateDictionaryITBase.java | 4 +- .../ResourceTypeDictionaryITBase.java | 4 +- .../AuthorityUpdateAndReadWorkIT.java | 78 +++++++++---------- .../data/e2e/resource/MergeResourcesIT.java | 4 +- .../ResourceControllerBaseValidationIT.java | 4 +- .../e2e/resource/ResourceControllerIT.java | 6 +- .../resource/ResourceControllerITBase.java | 4 +- ...urceControllerLccnPatternValidationIT.java | 6 +- ...eControllerLccnUniquenessValidationIT.java | 6 +- .../e2e/resource/ResourceControllerSrsIT.java | 4 +- .../resource/ResourceGraphControllerIT.java | 4 +- .../InventoryInstanceEventListenerIT.java | 4 +- .../SourceRecordDomainEventListenerIT.java | 27 +++---- .../SourceRecordDomainEventHandlerIT.java | 29 +++---- .../SourceRecordDomainEventHandlerTest.java | 12 +-- .../place/OriginPlaceMapperUnitTest.java | 4 +- .../work/sub/CarrierMapperUnitTest.java | 4 +- .../work/sub/ContentMapperUnitTest.java | 4 +- .../GovernmentPublicationMapperUnitTest.java | 4 +- .../work/sub/MediaMapperUnitTest.java | 4 +- .../sub/TargetAudienceMapperUnitTest.java | 4 +- .../entity/PrimaryTitleEntityValidatorIT.java | 4 +- .../ResourcePrePersistValidationIT.java | 4 +- 27 files changed, 136 insertions(+), 123 deletions(-) diff --git a/pom.xml b/pom.xml index e4057e4d..2fad0ae3 100644 --- a/pom.xml +++ b/pom.xml @@ -59,7 +59,7 @@ 5.0.0 - 7.9.0 + 7.11.0 1.0.1 3.6.0 3.4.0 @@ -78,36 +78,43 @@ folio-spring-base ${folio-spring-base.version} + org.folio folio-service-tools-spring-dev ${folio-service-tools.version} + org.folio lib-linked-data-dictionary ${lib-linked-data-dictionary.version} + org.folio lib-linked-data-marc4ld ${lib-linked-data-marc4ld.version} + org.folio lib-linked-data-fingerprint ${lib-linked-data-fingerprint.version} + org.folio mod-source-record-storage-client ${mod-source-record-storage-client.version} + org.folio mod-record-specifications-dto ${mod-record-specifications-dto.version} + org.folio folio-kafka-wrapper @@ -261,7 +268,6 @@ ${easy-random.version} test - @@ -585,6 +591,7 @@ FOLIO Maven repository https://repository.folio.org/repository/maven-folio + index-data-nexus FOLIO Maven repository @@ -600,6 +607,7 @@ false default + folio-nexus FOLIO Snapshot Repository diff --git a/src/main/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandler.java b/src/main/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandler.java index 998b9e62..2d214b1d 100644 --- a/src/main/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandler.java +++ b/src/main/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandler.java @@ -2,8 +2,8 @@ import static java.util.Objects.isNull; import static org.apache.commons.lang3.ObjectUtils.isEmpty; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.CREATED; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.UPDATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_CREATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_UPDATED; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_AUTHORITY; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_BIB; import static org.folio.linked.data.util.Constants.STANDALONE_PROFILE; @@ -32,7 +32,8 @@ public class SourceRecordDomainEventHandler { private static final String NO_MARC_EVENT = "SourceRecordDomainEvent [id {}] has no Marc record inside"; private static final String UNSUPPORTED_TYPE = "Ignoring unsupported {} type [{}] in SourceRecordDomainEvent [id {}]"; private static final Set SUPPORTED_RECORD_TYPES = Set.of(MARC_BIB, MARC_AUTHORITY); - private static final Set SUPPORTED_EVENT_TYPES = Set.of(CREATED, UPDATED); + private static final Set SUPPORTED_EVENT_TYPES = + Set.of(SOURCE_RECORD_CREATED, SOURCE_RECORD_UPDATED); private final ResourceMarcAuthorityService resourceMarcAuthorityService; private final ResourceMarcBibService resourceMarcBibService; private final MarcAuthority2ldMapper marcAuthority2ldMapper; @@ -45,7 +46,7 @@ public void handle(SourceRecordDomainEvent event, SourceRecordType recordType) { } if (recordType == MARC_AUTHORITY) { saveAuthorities(event); - } else if (recordType == MARC_BIB && event.getEventType() == CREATED) { + } else if (recordType == MARC_BIB && event.getEventType() == SOURCE_RECORD_CREATED) { saveAdminMetadata(event); } } @@ -78,7 +79,7 @@ private void saveAuthorities(SourceRecordDomainEvent event) { } private void saveAuthority(Resource resource, SourceRecordDomainEvent event) { - if (CREATED == event.getEventType() || UPDATED == event.getEventType()) { + if (SOURCE_RECORD_CREATED == event.getEventType() || SOURCE_RECORD_UPDATED == event.getEventType()) { var id = resourceMarcAuthorityService.saveMarcAuthority(resource); log.info(EVENT_SAVED, event.getId(), MARC_AUTHORITY, id); } diff --git a/src/test/java/org/folio/linked/data/e2e/ProfileControllerIT.java b/src/test/java/org/folio/linked/data/e2e/ProfileControllerIT.java index c5a8b7a7..a0bc2fa0 100644 --- a/src/test/java/org/folio/linked/data/e2e/ProfileControllerIT.java +++ b/src/test/java/org/folio/linked/data/e2e/ProfileControllerIT.java @@ -19,8 +19,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.core.env.Environment; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; @IntegrationTest @@ -35,7 +35,7 @@ class ProfileControllerIT { private ProfileRepository profileRepository; @Autowired private Environment env; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @Order(1) diff --git a/src/test/java/org/folio/linked/data/e2e/database/DatabaseITBase.java b/src/test/java/org/folio/linked/data/e2e/database/DatabaseITBase.java index 3409bd02..6f6e3eeb 100644 --- a/src/test/java/org/folio/linked/data/e2e/database/DatabaseITBase.java +++ b/src/test/java/org/folio/linked/data/e2e/database/DatabaseITBase.java @@ -6,8 +6,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; abstract class DatabaseITBase { @@ -26,7 +26,7 @@ abstract class DatabaseITBase { @Autowired private JdbcTemplate jdbcTemplate; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @Test diff --git a/src/test/java/org/folio/linked/data/e2e/dictionary/PredicateDictionaryITBase.java b/src/test/java/org/folio/linked/data/e2e/dictionary/PredicateDictionaryITBase.java index 8432a13d..6c618095 100644 --- a/src/test/java/org/folio/linked/data/e2e/dictionary/PredicateDictionaryITBase.java +++ b/src/test/java/org/folio/linked/data/e2e/dictionary/PredicateDictionaryITBase.java @@ -15,9 +15,9 @@ import org.junit.jupiter.params.provider.EnumSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.jdbc.JdbcTestUtils; abstract class PredicateDictionaryITBase { @@ -29,7 +29,7 @@ abstract class PredicateDictionaryITBase { @Autowired private JdbcTemplate jdbcTemplate; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @Test diff --git a/src/test/java/org/folio/linked/data/e2e/dictionary/ResourceTypeDictionaryITBase.java b/src/test/java/org/folio/linked/data/e2e/dictionary/ResourceTypeDictionaryITBase.java index dd6d54cb..946ecbf7 100644 --- a/src/test/java/org/folio/linked/data/e2e/dictionary/ResourceTypeDictionaryITBase.java +++ b/src/test/java/org/folio/linked/data/e2e/dictionary/ResourceTypeDictionaryITBase.java @@ -15,9 +15,9 @@ import org.junit.jupiter.params.provider.EnumSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.jdbc.JdbcTestUtils; abstract class ResourceTypeDictionaryITBase { @@ -28,7 +28,7 @@ abstract class ResourceTypeDictionaryITBase { private String schema; @Autowired private JdbcTemplate jdbcTemplate; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @Test diff --git a/src/test/java/org/folio/linked/data/e2e/resource/AuthorityUpdateAndReadWorkIT.java b/src/test/java/org/folio/linked/data/e2e/resource/AuthorityUpdateAndReadWorkIT.java index 53a25ee6..3b76be42 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/AuthorityUpdateAndReadWorkIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/AuthorityUpdateAndReadWorkIT.java @@ -8,8 +8,8 @@ import static org.folio.ld.dictionary.ResourceTypeDictionary.CONCEPT; import static org.folio.ld.dictionary.ResourceTypeDictionary.PERSON; import static org.folio.ld.dictionary.ResourceTypeDictionary.WORK; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.CREATED; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.UPDATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_CREATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_UPDATED; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_AUTHORITY; import static org.folio.linked.data.e2e.resource.ResourceControllerITBase.RESOURCE_URL; import static org.folio.linked.data.test.TestUtil.TENANT_ID; @@ -45,10 +45,10 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.core.env.Environment; import org.springframework.data.domain.Pageable; import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; import org.springframework.test.web.servlet.MockMvc; @IntegrationTest @@ -64,7 +64,7 @@ class AuthorityUpdateAndReadWorkIT { private KafkaSearchWorkIndexTopicListener kafkaSearchWorkIndexTopicListener; @Autowired private ResourceTestRepository resourceTestRepository; - @SpyBean + @MockitoSpyBean @Autowired private ResourceMarcAuthorityService resourceMarcService; @Autowired @@ -94,13 +94,13 @@ void authorityUpdate_withNewFingerprint_shouldLinkItToPreviousAndReturnAsWorkAct var authority = createAuthority(); var work = createWorkAndLinkToAuthority(authority); var authorityUpdateJson = getAuthorityJson().replace("aValue", "newAValue"); - var updateAuthorityEvent = - getSrsDomainEventProducerRecord(randomUUID().toString(), authorityUpdateJson, UPDATED, MARC_AUTHORITY); + var updateAuthorityEvent = getSrsDomainEventProducerRecord(randomUUID().toString(), authorityUpdateJson, + SOURCE_RECORD_UPDATED, MARC_AUTHORITY); // when eventKafkaTemplate.send(updateAuthorityEvent); awaitAndAssert(() -> verify(resourceMarcService, times(2)) - .saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class))); + .saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class))); // then var authoritiesFromDb = readAndAssertAuthoritiesInTheDb(); @@ -110,25 +110,25 @@ void authorityUpdate_withNewFingerprint_shouldLinkItToPreviousAndReturnAsWorkAct private void assertGetWorkWithActiveAuthority(Long workId, List authorities) throws Exception { var requestBuilder = get(RESOURCE_URL + "/" + workId) - .contentType(APPLICATION_JSON) - .headers(defaultHeaders(env)); + .contentType(APPLICATION_JSON) + .headers(defaultHeaders(env)); var resultActions = mockMvc.perform(requestBuilder); var response = resultActions - .andExpect(status().isOk()) - .andExpect(content().contentType(APPLICATION_JSON)) - .andReturn().getResponse().getContentAsString(); + .andExpect(status().isOk()) + .andExpect(content().contentType(APPLICATION_JSON)) + .andReturn().getResponse().getContentAsString(); assertThat(response) - .isNotEmpty() - .contains(authorities.get(1).getId().toString()) - .contains(authorities.get(1).getLabel()) - .doesNotContain(authorities.get(0).getId().toString()) - .doesNotContain(authorities.get(0).getLabel()); + .isNotEmpty() + .contains(authorities.get(1).getId().toString()) + .contains(authorities.get(1).getLabel()) + .doesNotContain(authorities.get(0).getId().toString()) + .doesNotContain(authorities.get(0).getLabel()); } private void assertWorkIsStillLinkedToObsoleteAuthorityInTheDb(Resource work, Resource obsoleteAuthority) { var workFromDb = tenantScopedExecutionService.execute( - TENANT_ID, - () -> resourceTestRepository.findByIdWithEdgesLoaded(work.getId()).orElseThrow() + TENANT_ID, + () -> resourceTestRepository.findByIdWithEdgesLoaded(work.getId()).orElseThrow() ); assertThat(workFromDb.getOutgoingEdges()).hasSize(3); assertThat(workFromDb.getOutgoingEdges()).contains(new ResourceEdge(workFromDb, obsoleteAuthority, AUTHOR)); @@ -137,12 +137,12 @@ private void assertWorkIsStillLinkedToObsoleteAuthorityInTheDb(Resource work, Re private List readAndAssertAuthoritiesInTheDb() { var authoritiesFromDb = tenantScopedExecutionService.execute( - TENANT_ID, - () -> resourceTestRepository.findAllByTypeWithEdgesLoaded(Set.of(CONCEPT.getUri(), PERSON.getUri()), 2, - Pageable.ofSize(10)) - .stream() - .sorted(comparing(Resource::getLabel)) - .toList() + TENANT_ID, + () -> resourceTestRepository.findAllByTypeWithEdgesLoaded(Set.of(CONCEPT.getUri(), PERSON.getUri()), 2, + Pageable.ofSize(10)) + .stream() + .sorted(comparing(Resource::getLabel)) + .toList() ); assertThat(authoritiesFromDb).hasSize(2); var expectedLabelCreated = "bValue, aValue, cValue, qValue, dValue -- vValue -- xValue -- yValue -- zValue"; @@ -153,16 +153,16 @@ private List readAndAssertAuthoritiesInTheDb() { } private Resource createAuthority() { - var authorityCreateEvent = - getSrsDomainEventProducerRecord(randomUUID().toString(), getAuthorityJson(), CREATED, MARC_AUTHORITY); + var authorityCreateEvent = getSrsDomainEventProducerRecord(randomUUID().toString(), getAuthorityJson(), + SOURCE_RECORD_CREATED, MARC_AUTHORITY); eventKafkaTemplate.send(authorityCreateEvent); awaitAndAssert(() -> verify(resourceMarcService) - .saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class))); + .saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class))); return tenantScopedExecutionService.execute(TENANT_ID, - () -> resourceTestRepository.findById(- 6897633277634168127L) - .stream() - .findFirst() - .orElseThrow() + () -> resourceTestRepository.findById(- 6897633277634168127L) + .stream() + .findFirst() + .orElseThrow() ); } @@ -184,13 +184,13 @@ private Resource createWorkAndLinkToAuthority(Resource authority) { reCreator.computeId(); work.addOutgoingEdge(reCreator); tenantScopedExecutionService.execute(TENANT_ID, - () -> { - resourceTestRepository.save(work); - resourceTestRepository.save(title); - resourceEdgeRepository.save(reTitle); - resourceEdgeRepository.save(reAuthor); - resourceEdgeRepository.save(reCreator); - } + () -> { + resourceTestRepository.save(work); + resourceTestRepository.save(title); + resourceEdgeRepository.save(reTitle); + resourceEdgeRepository.save(reAuthor); + resourceEdgeRepository.save(reCreator); + } ); return work; } diff --git a/src/test/java/org/folio/linked/data/e2e/resource/MergeResourcesIT.java b/src/test/java/org/folio/linked/data/e2e/resource/MergeResourcesIT.java index b5f4540c..f935142c 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/MergeResourcesIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/MergeResourcesIT.java @@ -25,8 +25,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest class MergeResourcesIT { @@ -41,7 +41,7 @@ class MergeResourcesIT { private ObjectMapper objectMapper; @Autowired private TenantScopedExecutionService tenantScopedExecutionService; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @BeforeEach diff --git a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerBaseValidationIT.java b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerBaseValidationIT.java index 08933bb6..f7693b93 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerBaseValidationIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerBaseValidationIT.java @@ -19,14 +19,14 @@ import org.folio.spring.tools.kafka.KafkaAdminService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest class ResourceControllerBaseValidationIT extends AbstractResourceControllerIT { @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @Test diff --git a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerIT.java b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerIT.java index f38bed95..5bd670ba 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerIT.java @@ -23,7 +23,7 @@ import org.junit.jupiter.api.BeforeEach; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.SpyBean; +import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; @IntegrationTest @SpringBootTest(classes = {KafkaProducerTestConfiguration.class}) @@ -33,9 +33,9 @@ class ResourceControllerIT extends ResourceControllerITBase { private KafkaSearchWorkIndexTopicListener searchIndexTopicListener; @Autowired private KafkaInventoryTopicListener inventoryTopicListener; - @SpyBean + @MockitoSpyBean private WorkCreateMessageSender createEventProducer; - @SpyBean + @MockitoSpyBean private WorkDeleteMessageSender deleteEventProducer; @BeforeAll diff --git a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerITBase.java b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerITBase.java index 530418bf..03cc0240 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerITBase.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerITBase.java @@ -287,8 +287,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.ValueSource; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.ResponseEntity; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.ResultActions; abstract class ResourceControllerITBase extends AbstractResourceControllerIT { @@ -299,7 +299,7 @@ abstract class ResourceControllerITBase extends AbstractResourceControllerIT { private static final UUID USER_ID = UUID.randomUUID(); - @MockBean + @MockitoBean private SpecClient specClient; private LookupResources lookupResources; diff --git a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnPatternValidationIT.java b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnPatternValidationIT.java index d9586f09..a5a9efc6 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnPatternValidationIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnPatternValidationIT.java @@ -31,16 +31,16 @@ import org.folio.linked.data.domain.dto.SearchResponseTotalOnly; import org.folio.linked.data.e2e.base.IntegrationTest; import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest class ResourceControllerLccnPatternValidationIT extends AbstractResourceControllerIT { - @MockBean + @MockitoBean private SpecClient specClient; - @MockBean + @MockitoBean private SearchClient searchClient; @Test diff --git a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnUniquenessValidationIT.java b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnUniquenessValidationIT.java index 54a57845..888a431a 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnUniquenessValidationIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerLccnUniquenessValidationIT.java @@ -30,9 +30,9 @@ import org.folio.linked.data.test.kafka.KafkaProducerTestConfiguration; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest @SpringBootTest(classes = {KafkaProducerTestConfiguration.class}) @@ -41,9 +41,9 @@ class ResourceControllerLccnUniquenessValidationIT extends AbstractResourceContr private static final String LCCN_VALIDATION_NOT_AVAILABLE = "[Could not validate LCCN for duplicate] - reason: [Unable to reach search service]. Please try later."; - @MockBean + @MockitoBean private SearchClient searchClient; - @MockBean + @MockitoBean private SettingsService settingsService; @Test diff --git a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerSrsIT.java b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerSrsIT.java index 137e6183..95cebcce 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerSrsIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/ResourceControllerSrsIT.java @@ -22,14 +22,14 @@ import org.folio.rest.jaxrs.model.ParsedRecord; import org.folio.rest.jaxrs.model.Record; import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpStatusCode; import org.springframework.http.ResponseEntity; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest class ResourceControllerSrsIT extends AbstractResourceControllerIT { - @MockBean + @MockitoBean private SrsClient srsClient; @Test diff --git a/src/test/java/org/folio/linked/data/e2e/resource/ResourceGraphControllerIT.java b/src/test/java/org/folio/linked/data/e2e/resource/ResourceGraphControllerIT.java index 12cc7446..e1c8bafa 100644 --- a/src/test/java/org/folio/linked/data/e2e/resource/ResourceGraphControllerIT.java +++ b/src/test/java/org/folio/linked/data/e2e/resource/ResourceGraphControllerIT.java @@ -30,9 +30,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.ResultActions; @@ -51,7 +51,7 @@ class ResourceGraphControllerIT { private ObjectMapper objectMapper; @Autowired private TenantScopedExecutionService tenantScopedExecutionService; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @BeforeEach diff --git a/src/test/java/org/folio/linked/data/integration/kafka/listener/InventoryInstanceEventListenerIT.java b/src/test/java/org/folio/linked/data/integration/kafka/listener/InventoryInstanceEventListenerIT.java index 5027a7f8..a1e67b98 100644 --- a/src/test/java/org/folio/linked/data/integration/kafka/listener/InventoryInstanceEventListenerIT.java +++ b/src/test/java/org/folio/linked/data/integration/kafka/listener/InventoryInstanceEventListenerIT.java @@ -17,8 +17,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest class InventoryInstanceEventListenerIT { @@ -29,7 +29,7 @@ class InventoryInstanceEventListenerIT { @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private InventoryInstanceEventHandler inventoryInstanceDomainEventHandler; @BeforeAll diff --git a/src/test/java/org/folio/linked/data/integration/kafka/listener/SourceRecordDomainEventListenerIT.java b/src/test/java/org/folio/linked/data/integration/kafka/listener/SourceRecordDomainEventListenerIT.java index 47a9ea0c..0e944653 100644 --- a/src/test/java/org/folio/linked/data/integration/kafka/listener/SourceRecordDomainEventListenerIT.java +++ b/src/test/java/org/folio/linked/data/integration/kafka/listener/SourceRecordDomainEventListenerIT.java @@ -1,6 +1,6 @@ package org.folio.linked.data.integration.kafka.listener; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.CREATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_CREATED; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_AUTHORITY; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_BIB; import static org.folio.linked.data.test.TestUtil.TENANT_ID; @@ -22,8 +22,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest class SourceRecordDomainEventListenerIT { @@ -31,7 +31,7 @@ class SourceRecordDomainEventListenerIT { @Autowired private KafkaTemplate eventKafkaTemplate; - @MockBean + @MockitoBean private SourceRecordDomainEventHandler sourceRecordDomainEventHandler; @BeforeAll @@ -43,14 +43,15 @@ static void setup(@Autowired KafkaAdminService kafkaAdminService) { void shouldHandleSrsDomainEvent_whenSourceRecordType_isMarcBib() { // given var eventProducerRecord = getSrsDomainEventSampleProducerRecord(); - var expectedEvent = new SourceRecordDomainEvent("23b34a6f-c095-41ea-917b-9765add1a444", CREATED).eventPayload( - new SourceRecord() - .id("758f57ff-7dad-419e-803c-44b621400c11") - .parsedRecord(new ParsedRecord() - .content(TestUtil.loadResourceAsString("samples/srsDomainEventParsedContent.txt")) - ) - .deleted(true) - ); + var expectedEvent = new SourceRecordDomainEvent("23b34a6f-c095-41ea-917b-9765add1a444", SOURCE_RECORD_CREATED) + .eventPayload( + new SourceRecord() + .id("758f57ff-7dad-419e-803c-44b621400c11") + .parsedRecord(new ParsedRecord() + .content(TestUtil.loadResourceAsString("samples/srsDomainEventParsedContent.txt")) + ) + .deleted(true) + ); // when eventKafkaTemplate.send(eventProducerRecord); @@ -65,7 +66,7 @@ void shouldRetryIfErrorOccurs() { var eventId = "event_id_02"; var marc = "{}"; var recordType = MARC_BIB; - var eventType = CREATED; + var eventType = SOURCE_RECORD_CREATED; var eventProducerRecord = getSrsDomainEventProducerRecord(eventId, marc, eventType, recordType); var expectedEvent = getSrsDomainEvent(eventId, marc, eventType); doThrow(new RuntimeException("An error occurred")) @@ -84,7 +85,7 @@ void shouldHandleSrsDomainEvent_whenSourceRecordType_isMarcAuthority() { // given var eventId = "2"; var marc = "{}"; - var eventType = CREATED; + var eventType = SOURCE_RECORD_CREATED; var eventProducerRecord = getSrsDomainEventProducerRecord(eventId, marc, eventType, MARC_AUTHORITY); var expectedEvent = getSrsDomainEvent(eventId, marc, eventType); diff --git a/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerIT.java b/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerIT.java index 89d9ea0f..05c73c17 100644 --- a/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerIT.java +++ b/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerIT.java @@ -8,8 +8,8 @@ import static org.folio.ld.dictionary.ResourceTypeDictionary.CONCEPT; import static org.folio.ld.dictionary.ResourceTypeDictionary.INSTANCE; import static org.folio.ld.dictionary.ResourceTypeDictionary.PERSON; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.CREATED; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.UPDATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_CREATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_UPDATED; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_AUTHORITY; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_BIB; import static org.folio.linked.data.test.TestUtil.TENANT_ID; @@ -50,11 +50,11 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.mock.mockito.SpyBean; import org.springframework.data.domain.Pageable; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.kafka.core.KafkaTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; +import org.springframework.test.context.bean.override.mockito.MockitoSpyBean; @IntegrationTest class SourceRecordDomainEventHandlerIT { @@ -67,7 +67,7 @@ class SourceRecordDomainEventHandlerIT { private TenantScopedExecutionService tenantScopedExecutionService; @Autowired private KafkaSearchWorkIndexTopicListener kafkaSearchWorkIndexTopicListener; - @MockBean + @MockitoBean private FolioMessageProducer instanceIngressMessageProducer; @Autowired private MarcBib2ldMapper marcBib2ldMapper; @@ -75,13 +75,13 @@ class SourceRecordDomainEventHandlerIT { private ResourceModelMapper resourceModelMapper; @Autowired private ResourceTestRepository resourceTestRepository; - @SpyBean + @MockitoSpyBean @Autowired private ResourceMarcAuthorityService resourceMarcAuthorityService; - @SpyBean + @MockitoSpyBean @Autowired private ResourceMarcBibService resourceMarcBibService; - @SpyBean + @MockitoSpyBean @Autowired private ResourceModificationEventListener eventListener; @Autowired @@ -110,7 +110,8 @@ public void clean() { void shouldNotProcessEventForNullableResource(String resource, int interactions) { // given var marc = loadResourceAsString(resource); - var eventProducerRecord = getSrsDomainEventProducerRecord(randomUUID().toString(), marc, CREATED, MARC_BIB); + var eventProducerRecord = + getSrsDomainEventProducerRecord(randomUUID().toString(), marc, SOURCE_RECORD_CREATED, MARC_BIB); // when eventKafkaTemplate.send(eventProducerRecord); @@ -132,7 +133,8 @@ void shouldSaveAdminMetadataOutOfMarcBibSourceRecordDomainEvent() { existedInstance.addOutgoingEdge(new ResourceEdge(existedInstance, title, PredicateDictionary.TITLE)); resourceTestRepository.save(existedInstance); var marc = loadResourceAsString("samples/marc2ld/full_marc_sample.jsonl"); - var eventProducerRecord = getSrsDomainEventProducerRecord(randomUUID().toString(), marc, CREATED, MARC_BIB); + var eventProducerRecord = + getSrsDomainEventProducerRecord(randomUUID().toString(), marc, SOURCE_RECORD_CREATED, MARC_BIB); // when eventKafkaTemplate.send(eventProducerRecord); @@ -169,7 +171,8 @@ void shouldProcessAuthoritySourceRecordDomainCreateEvent() { .replace("aValue", "aaValue") .replace("1125d50a-adea-4eaa-a418-6b3a0e6fa6ae", UUID.randomUUID().toString()) .replace("6dcb9a08-9884-4a15-b990-89c879a8e988", UUID.randomUUID().toString()); - var eventProducerRecord = getSrsDomainEventProducerRecord(randomUUID().toString(), marc, CREATED, MARC_AUTHORITY); + var eventProducerRecord = + getSrsDomainEventProducerRecord(randomUUID().toString(), marc, SOURCE_RECORD_CREATED, MARC_AUTHORITY); // when eventKafkaTemplate.send(eventProducerRecord); @@ -198,13 +201,13 @@ void shouldProcessAuthoritySourceRecordDomainUpdateEvent() { .replace("1125d50a-adea-4eaa-a418-6b3a0e6fa6ae", UUID.randomUUID().toString()) .replace("6dcb9a08-9884-4a15-b990-89c879a8e988", UUID.randomUUID().toString()); var eventProducerRecordCreate = - getSrsDomainEventProducerRecord(randomUUID().toString(), marcCreate, CREATED, MARC_AUTHORITY); + getSrsDomainEventProducerRecord(randomUUID().toString(), marcCreate, SOURCE_RECORD_CREATED, MARC_AUTHORITY); eventKafkaTemplate.send(eventProducerRecordCreate); awaitAndAssert(() -> verify(resourceMarcAuthorityService) .saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class))); var marcUpdate = marcCreate.replace("aValue", "newAValue"); var eventProducerRecordUpdate = - getSrsDomainEventProducerRecord(randomUUID().toString(), marcUpdate, UPDATED, MARC_AUTHORITY); + getSrsDomainEventProducerRecord(randomUUID().toString(), marcUpdate, SOURCE_RECORD_UPDATED, MARC_AUTHORITY); // when eventKafkaTemplate.send(eventProducerRecordUpdate); diff --git a/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerTest.java b/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerTest.java index d4b74d60..2c4f5a48 100644 --- a/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerTest.java +++ b/src/test/java/org/folio/linked/data/integration/kafka/listener/handler/SourceRecordDomainEventHandlerTest.java @@ -3,8 +3,8 @@ import static org.folio.ld.dictionary.ResourceTypeDictionary.CONCEPT; import static org.folio.ld.dictionary.ResourceTypeDictionary.INSTANCE; import static org.folio.ld.dictionary.ResourceTypeDictionary.PERSON; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.CREATED; -import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.UPDATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_CREATED; +import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_UPDATED; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_AUTHORITY; import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_BIB; import static org.mockito.Mockito.doReturn; @@ -92,7 +92,7 @@ void shouldNotTriggerSaving_ifIncomingEventContainsNotSupportedEventType() { void shouldNotTriggerSaving_ifResourceMappedOutOfIncomingEventIsEmpty() { // given var event = new SourceRecordDomainEvent().id("4") - .eventType(CREATED) + .eventType(SOURCE_RECORD_CREATED) .eventPayload(new SourceRecord().parsedRecord(new ParsedRecord("{ \"key\": \"value\"}"))); // when @@ -107,7 +107,7 @@ void shouldNotTriggerSaving_ifResourceMappedOutOfIncomingEventIsEmpty() { void shouldTriggerAuthoritySaving_forCorrectMarcAuthorityEvent() { // given var event = new SourceRecordDomainEvent().id("8") - .eventType(CREATED) + .eventType(SOURCE_RECORD_CREATED) .eventPayload(new SourceRecord().parsedRecord(new ParsedRecord("{ \"key\": \"value\"}"))); var mapped1 = new Resource().setId(9L).addType(PERSON); var mapped2 = new Resource().setId(10L).addType(CONCEPT); @@ -127,7 +127,7 @@ void shouldTriggerAuthoritySaving_forCorrectMarcAuthorityEvent() { void shouldTriggerAdminMetadataSaving_forCorrectMarcBibEvent() { // given var event = new SourceRecordDomainEvent().id("7") - .eventType(CREATED) + .eventType(SOURCE_RECORD_CREATED) .eventPayload(new SourceRecord().parsedRecord(new ParsedRecord("{ \"key\": \"value\"}"))); var mapped = new Resource().setId(9L).addType(INSTANCE); doReturn(Optional.of(mapped)).when(marcBib2ldMapper) @@ -145,7 +145,7 @@ void shouldTriggerAdminMetadataSaving_forCorrectMarcBibEvent() { void shouldNotTriggerAdminMetadataSaving_forUpdateMarcBibEvent() { // given var event = new SourceRecordDomainEvent().id("7") - .eventType(UPDATED) + .eventType(SOURCE_RECORD_UPDATED) .eventPayload(new SourceRecord().parsedRecord(new ParsedRecord("{ \"key\": \"value\"}"))); // when diff --git a/src/test/java/org/folio/linked/data/mapper/dto/monograph/common/place/OriginPlaceMapperUnitTest.java b/src/test/java/org/folio/linked/data/mapper/dto/monograph/common/place/OriginPlaceMapperUnitTest.java index 8cad667a..775243ef 100644 --- a/src/test/java/org/folio/linked/data/mapper/dto/monograph/common/place/OriginPlaceMapperUnitTest.java +++ b/src/test/java/org/folio/linked/data/mapper/dto/monograph/common/place/OriginPlaceMapperUnitTest.java @@ -19,8 +19,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = OriginPlaceMapperUnit.class) @Import({CoreMapperImpl.class, ObjectMapper.class, RequestProcessingExceptionBuilder.class, ErrorResponseConfig.class}) @@ -31,7 +31,7 @@ class OriginPlaceMapperUnitTest { private OriginPlaceMapperUnit originPlaceMapperUnit; @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private HashService hashService; @Test diff --git a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/CarrierMapperUnitTest.java b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/CarrierMapperUnitTest.java index 6a2633a3..97d194e2 100644 --- a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/CarrierMapperUnitTest.java +++ b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/CarrierMapperUnitTest.java @@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = CarrierMapperUnit.class) @Import({CoreMapperImpl.class, ObjectMapper.class, RequestProcessingExceptionBuilder.class, ErrorResponseConfig.class}) @@ -31,7 +31,7 @@ class CarrierMapperUnitTest { private CarrierMapperUnit carrierMapperUnit; @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private HashService hashService; @Test diff --git a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/ContentMapperUnitTest.java b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/ContentMapperUnitTest.java index d0c038ab..fab9bddd 100644 --- a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/ContentMapperUnitTest.java +++ b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/ContentMapperUnitTest.java @@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = ContentMapperUnit.class) @Import({CoreMapperImpl.class, ObjectMapper.class, RequestProcessingExceptionBuilder.class, ErrorResponseConfig.class}) @@ -34,7 +34,7 @@ class ContentMapperUnitTest { private ContentMapperUnit contentMapperUnit; @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private HashService hashService; @Test diff --git a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/GovernmentPublicationMapperUnitTest.java b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/GovernmentPublicationMapperUnitTest.java index d98b189e..218d7241 100644 --- a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/GovernmentPublicationMapperUnitTest.java +++ b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/GovernmentPublicationMapperUnitTest.java @@ -20,8 +20,8 @@ import org.junit.jupiter.params.provider.CsvSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = GovernmentPublicationMapperUnit.class) @Import({CoreMapperImpl.class, ObjectMapper.class, RequestProcessingExceptionBuilder.class, ErrorResponseConfig.class}) @@ -31,7 +31,7 @@ class GovernmentPublicationMapperUnitTest { private GovernmentPublicationMapperUnit governmentPublicationMapperUnit; @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private HashService hashService; @ParameterizedTest diff --git a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/MediaMapperUnitTest.java b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/MediaMapperUnitTest.java index 035db526..15d34378 100644 --- a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/MediaMapperUnitTest.java +++ b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/MediaMapperUnitTest.java @@ -20,8 +20,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = MediaMapperUnit.class) @Import({CoreMapperImpl.class, ObjectMapper.class, RequestProcessingExceptionBuilder.class, ErrorResponseConfig.class}) @@ -31,7 +31,7 @@ class MediaMapperUnitTest { private MediaMapperUnit mediaMapperUnit; @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private HashService hashService; @Test diff --git a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/TargetAudienceMapperUnitTest.java b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/TargetAudienceMapperUnitTest.java index 7af56472..6db86bce 100644 --- a/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/TargetAudienceMapperUnitTest.java +++ b/src/test/java/org/folio/linked/data/mapper/dto/monograph/work/sub/TargetAudienceMapperUnitTest.java @@ -25,8 +25,8 @@ import org.junit.jupiter.params.provider.CsvSource; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = TargetAudienceMapperUnit.class) @Import({CoreMapperImpl.class, ObjectMapper.class, RequestProcessingExceptionBuilder.class, ErrorResponseConfig.class}) @@ -36,7 +36,7 @@ class TargetAudienceMapperUnitTest { private TargetAudienceMapperUnit targetAudienceMapperUnit; @Autowired private ObjectMapper objectMapper; - @MockBean + @MockitoBean private HashService hashService; @ParameterizedTest diff --git a/src/test/java/org/folio/linked/data/validation/entity/PrimaryTitleEntityValidatorIT.java b/src/test/java/org/folio/linked/data/validation/entity/PrimaryTitleEntityValidatorIT.java index 4053630c..2292a967 100644 --- a/src/test/java/org/folio/linked/data/validation/entity/PrimaryTitleEntityValidatorIT.java +++ b/src/test/java/org/folio/linked/data/validation/entity/PrimaryTitleEntityValidatorIT.java @@ -13,7 +13,7 @@ import org.folio.spring.tools.kafka.KafkaAdminService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.transaction.TransactionSystemException; @IntegrationTest @@ -21,7 +21,7 @@ class PrimaryTitleEntityValidatorIT { @Autowired private ResourceRepository resourceRepository; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @Test diff --git a/src/test/java/org/folio/linked/data/validation/entity/ResourcePrePersistValidationIT.java b/src/test/java/org/folio/linked/data/validation/entity/ResourcePrePersistValidationIT.java index 6e9e9111..a9993117 100644 --- a/src/test/java/org/folio/linked/data/validation/entity/ResourcePrePersistValidationIT.java +++ b/src/test/java/org/folio/linked/data/validation/entity/ResourcePrePersistValidationIT.java @@ -11,13 +11,13 @@ import org.folio.spring.tools.kafka.KafkaAdminService; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @IntegrationTest class ResourcePrePersistValidationIT { @Autowired private ResourceRepository resourceRepository; - @MockBean + @MockitoBean private KafkaAdminService kafkaAdminService; @Test