From 7de7d7f32ece526c094d12f04602527780f305af Mon Sep 17 00:00:00 2001 From: flaminiaScarciofolo Date: Fri, 10 May 2024 14:22:29 +0200 Subject: [PATCH] [SELC-4864] Feat: mapped institution taxCode in brokerInfo code --- connector/rest/docs/openapi/api-selfcare-core-docs.json | 3 +++ .../connector/rest/model/mapper/BrokerMapper.java | 2 +- .../dashboard/connector/rest/CoreConnectorImplTest.java | 8 +++----- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/connector/rest/docs/openapi/api-selfcare-core-docs.json b/connector/rest/docs/openapi/api-selfcare-core-docs.json index 13b99c3df..59eff9e6f 100644 --- a/connector/rest/docs/openapi/api-selfcare-core-docs.json +++ b/connector/rest/docs/openapi/api-selfcare-core-docs.json @@ -4450,6 +4450,9 @@ "numberOfDelegations" : { "type" : "integer", "format" : "int32" + }, + "taxCode" : { + "type" : "string" } } }, diff --git a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/BrokerMapper.java b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/BrokerMapper.java index 7cfacc0ea..6fe528fcd 100644 --- a/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/BrokerMapper.java +++ b/connector/rest/src/main/java/it/pagopa/selfcare/dashboard/connector/rest/model/mapper/BrokerMapper.java @@ -19,7 +19,7 @@ public interface BrokerMapper { @Mapping(source = "id", target = "code") BrokerInfo fromInstitution(Institution institution); - @Mapping(source = "id", target = "code") + @Mapping(source = "taxCode", target = "code") BrokerInfo fromInstitution(BrokerResponse institutions); List fromInstitutions(List institutions); diff --git a/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java b/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java index 7821ecf20..e21d6976c 100644 --- a/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java +++ b/connector/rest/src/test/java/it/pagopa/selfcare/dashboard/connector/rest/CoreConnectorImplTest.java @@ -257,14 +257,12 @@ void findInstitutionsByProductIdAndType() { // given final String productId = "prod"; final String type = "PT"; - Institution institution = new Institution(); - institution.setId("id"); - institution.setDescription("description"); BrokerInfo brokerInfo = new BrokerInfo(); brokerInfo.setCode("id"); brokerInfo.setDescription("description"); BrokerResponse brokerResponse = new BrokerResponse(); brokerResponse.setDescription("description"); + brokerResponse.setTaxCode("taxCode"); when(brokerMapper.fromInstitutions(anyList())).thenReturn(List.of(brokerInfo)); when(coreInstitutionApiRestClient._getInstitutionBrokersUsingGET(any(), any())) .thenReturn(ResponseEntity.of(Optional.of(List.of(brokerResponse)))); @@ -274,8 +272,8 @@ void findInstitutionsByProductIdAndType() { assertNotNull(response); assertEquals(1, response.size()); assertNotNull(response.get(0)); - assertEquals(response.get(0).getCode(), institution.getId()); - assertEquals(response.get(0).getDescription(), institution.getDescription()); + assertEquals(response.get(0).getCode(), brokerResponse.getTaxCode()); + assertEquals(response.get(0).getDescription(), brokerResponse.getDescription()); }