diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 138de10..8d2f398 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -37,7 +37,7 @@ jobs: distribution: 'temurin' cache: maven - name: Build with Maven - run: mvn clean install -P jar -DskipTests + run: mvn clean install -P jar -DskipTests -Ddependency-check.skip=true - name: Upload artifact to GitHub uses: actions/upload-artifact@v4.6.0 diff --git a/pom.xml b/pom.xml index e7d32a4..0417bb5 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 3.2.5 + 3.4.1 it.govpay.gpd @@ -31,10 +31,10 @@ 1.6.0 - 2.11.0 + 2.18.0 - 6.4.0 + 6.6.0 0.2.1 @@ -55,6 +55,18 @@ 3.5.3 1.3.2 + + src/main/resources/owasp/falsePositives + + verify + 11.1.1 + true + false + 5 + + 1.5.16 + + 2.3.232 @@ -358,6 +370,45 @@ + + + org.owasp + dependency-check-maven + ${owasp.plugin.version} + + + check owasp + ${owasp} + + ${owasp.plugin.autoUpdate} + ${owasp.plugin.failBuildOnAnyVulnerability} + ALL + + ${owasp.falsePositives.dir}/CVE-2018-14335.xml + + 120000 + 3 + + + aggregate + + + + + + com.github.spotbugs + spotbugs-maven-plugin + 4.8.6.0 + + + + com.h3xstream.findsecbugs + findsecbugs-plugin + 1.12.0 + + + + diff --git a/src/main/java/it/govpay/gpd/client/config/GdeRestTemplateConfig.java b/src/main/java/it/govpay/gpd/client/config/GdeRestTemplateConfig.java index 7cc0afb..3ee3070 100644 --- a/src/main/java/it/govpay/gpd/client/config/GdeRestTemplateConfig.java +++ b/src/main/java/it/govpay/gpd/client/config/GdeRestTemplateConfig.java @@ -3,7 +3,6 @@ import java.net.http.HttpClient; import java.net.http.HttpClient.Builder; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -16,14 +15,11 @@ @Configuration public class GdeRestTemplateConfig { - @Autowired - ObjectMapper objectMapper; - @Value("${it.govpay.gde.client.baseUrl}") protected String baseUrl; @Bean("gdeApi") - EventiApi gdeApi() { + EventiApi gdeApi(ObjectMapper objectMapper) { Builder builder = HttpClient.newBuilder(); ApiClient apiClient= new ApiClient(builder, objectMapper, baseUrl); diff --git a/src/main/java/it/govpay/gpd/gde/service/GdeService.java b/src/main/java/it/govpay/gpd/gde/service/GdeService.java index 9300b92..f4ae25f 100644 --- a/src/main/java/it/govpay/gpd/gde/service/GdeService.java +++ b/src/main/java/it/govpay/gpd/gde/service/GdeService.java @@ -5,7 +5,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpMethod; @@ -34,18 +33,20 @@ public class GdeService { private Logger logger = LoggerFactory.getLogger(GdeService.class); - @Autowired - @Qualifier("gdeApi") EventiApi gdeApi; @Value("${it.govpay.gde.enabled:true}") Boolean gdeEnabled; - @Autowired ObjectMapper objectMapper; - @Autowired EventoGdpMapperImpl eventoGdpMapper; + + public GdeService(ObjectMapper objectMapper,@Qualifier("gdeApi") EventiApi gdeApi, EventoGdpMapperImpl eventoGdpMapper) { + this.objectMapper = objectMapper; + this.gdeApi = gdeApi; + this.eventoGdpMapper = eventoGdpMapper; + } public void inviaEvento(NuovoEvento nuovoEvento) { if(this.gdeEnabled.booleanValue()) { diff --git a/src/main/java/it/govpay/gpd/mapper/PaymentPositionModelRequestMapper.java b/src/main/java/it/govpay/gpd/mapper/PaymentPositionModelRequestMapper.java index 465b6ba..a626d4d 100644 --- a/src/main/java/it/govpay/gpd/mapper/PaymentPositionModelRequestMapper.java +++ b/src/main/java/it/govpay/gpd/mapper/PaymentPositionModelRequestMapper.java @@ -107,10 +107,7 @@ public String mapUoAnagrafica(VersamentoGpdEntity versamentoGpdEntity) { @Named("mapValidityDate") public OffsetDateTime mapValidityDate(VersamentoGpdEntity versamentoGpdEntity) { - // Otteniamo l'offset per il fuso orario di Roma - ZoneOffset offset = ZoneOffset.ofHoursMinutes(1, 0); // CET (Central European Time) - LocalDateTime dueDate = Utils.calcolaDueDate(versamentoGpdEntity); - return dueDate != null ? dueDate.atOffset(offset) : null; + return leggiDueDate(versamentoGpdEntity); } @Named("mapPaymentOption") @@ -146,14 +143,16 @@ public Boolean mapPartialPayment(VersamentoGpdEntity versamentoGpdEntity) { @Named("mapDueDate") public OffsetDateTime mapDueDate(VersamentoGpdEntity versamentoGpdEntity) { - // Otteniamo l'offset per il fuso orario di Roma - ZoneOffset offset = ZoneOffset.ofHoursMinutes(1, 0); // CET (Central European Time) - LocalDateTime dueDate = Utils.calcolaDueDate(versamentoGpdEntity); - return dueDate != null ? dueDate.atOffset(offset) : null; + return leggiDueDate(versamentoGpdEntity); } @Named("mapRetentionDate") public OffsetDateTime mapRetentionDate(VersamentoGpdEntity versamentoGpdEntity) { + return leggiDueDate(versamentoGpdEntity); + } + + + private OffsetDateTime leggiDueDate(VersamentoGpdEntity versamentoGpdEntity) { // Otteniamo l'offset per il fuso orario di Roma ZoneOffset offset = ZoneOffset.ofHoursMinutes(1, 0); // CET (Central European Time) LocalDateTime dueDate = Utils.calcolaDueDate(versamentoGpdEntity); diff --git a/src/main/java/it/govpay/gpd/step/SendPendenzaToGpdProcessor.java b/src/main/java/it/govpay/gpd/step/SendPendenzaToGpdProcessor.java index c7398d5..d25e367 100644 --- a/src/main/java/it/govpay/gpd/step/SendPendenzaToGpdProcessor.java +++ b/src/main/java/it/govpay/gpd/step/SendPendenzaToGpdProcessor.java @@ -6,7 +6,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.batch.item.ItemProcessor; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; import org.springframework.http.HttpStatusCode; @@ -38,19 +37,24 @@ public class SendPendenzaToGpdProcessor implements ItemProcessor + + + + ^pkg:maven/com\.h2database/h2@.*$ + CVE-2018-14335 + + \ No newline at end of file diff --git a/src/test/java/it/govpay/gpd/test/UC_1_HappyPathTest.java b/src/test/java/it/govpay/gpd/test/UC_1_HappyPathTest.java index 7d28506..b207fbf 100644 --- a/src/test/java/it/govpay/gpd/test/UC_1_HappyPathTest.java +++ b/src/test/java/it/govpay/gpd/test/UC_1_HappyPathTest.java @@ -94,7 +94,7 @@ class UC_1_HappyPathTest extends UC_00_BaseTest { HttpResponse mockHttpResponseOk; - private void initailizeJobLauncherTestUtils() throws Exception { + private void initailizeJobLauncherTestUtils() { jobLauncherTestUtils.setJob(job); } @@ -103,8 +103,9 @@ void tearDown() { jobRepositoryTestUtils.removeJobExecutions(); } + @SuppressWarnings("unchecked") @BeforeEach - void setUp() throws Exception { + void setUp() { MockitoAnnotations.openMocks(this); this.cleanDB(); @@ -147,8 +148,7 @@ void TC_01_EmptyRunTest() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -179,8 +179,7 @@ void TC_02_SendTestOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -221,9 +220,7 @@ void TC_03_SendTest_KO() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.SERVICE_UNAVAILABLE); - - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.SERVICE_UNAVAILABLE); } }); @@ -240,7 +237,6 @@ public CompletableFuture> answer(InvocationOnMock invo assertEquals(1, VersamentoUtils.countVersamentiDaSpedire(this.versamentoGpdRepository, this.numeroGiorni)); assertEquals(1, this.versamentoRepository.count()); -// initailizeJobLauncherTestUtils(); JobExecution jobExecution = jobLauncherTestUtils.launchJob(); assertEquals("COMPLETED", jobExecution.getExitStatus().getExitCode()); @@ -270,8 +266,7 @@ void TC_04_SendTestPendenzeMultipleOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -280,8 +275,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -327,8 +321,7 @@ public ResponseEntity answer(InvocationOnMock invocation) assertNotNull(paymentOption); assertEquals(true, paymentOption.get(0).isIsPartialPayment()); - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -387,8 +380,7 @@ public ResponseEntity answer(InvocationOnMock invocation) assertEquals("valore", transferMetadataModel.getValue()); } - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -439,8 +431,7 @@ public ResponseEntity answer(InvocationOnMock invocation) assertNotNull(transferList); assertEquals(2, transferList.size()); - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); diff --git a/src/test/java/it/govpay/gpd/test/UC_2_AggiornamentiTest.java b/src/test/java/it/govpay/gpd/test/UC_2_AggiornamentiTest.java index c06dbe8..147e1be 100644 --- a/src/test/java/it/govpay/gpd/test/UC_2_AggiornamentiTest.java +++ b/src/test/java/it/govpay/gpd/test/UC_2_AggiornamentiTest.java @@ -91,7 +91,7 @@ class UC_2_AggiornamentiTest extends UC_00_BaseTest { HttpResponse mockHttpResponseOk; - private void initailizeJobLauncherTestUtils() throws Exception { + private void initailizeJobLauncherTestUtils() { jobLauncherTestUtils.setJob(job); } @@ -100,6 +100,7 @@ void tearDown() { jobRepositoryTestUtils.removeJobExecutions(); } + @SuppressWarnings("unchecked") @BeforeEach void setUp() { MockitoAnnotations.openMocks(this); @@ -147,8 +148,7 @@ void TC_01_SendTest_CambiStatoOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -203,8 +203,7 @@ void TC_02_SendTest_DataValiditaOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -213,8 +212,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -258,8 +256,7 @@ void TC_03_SendTest_DataScadenzaOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -268,8 +265,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -313,8 +309,7 @@ void TC_04_SendTest_UpdateValidityDateOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -323,8 +318,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -364,8 +358,7 @@ public CompletableFuture> answer(InvocationOnMock invo )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseUpdatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseUpdatePaymentPositionModelOk(invocation); } }); @@ -374,8 +367,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -413,8 +405,7 @@ void TC_05_SendTest_UpdateNoValidityDateOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -454,8 +445,7 @@ public CompletableFuture> answer(InvocationOnMock invo )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseUpdatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseUpdatePaymentPositionModelOk(invocation); } }); @@ -495,8 +485,7 @@ void TC_06_SendTest_InvalidateOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -505,8 +494,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -547,8 +535,7 @@ public CompletableFuture> answer(InvocationOnMock invo )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseInvalidatePositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseInvalidatePositionOk(invocation); } }); @@ -588,8 +575,7 @@ void TC_07_SendTest_InvalidateKo() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -598,8 +584,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -640,8 +625,7 @@ public CompletableFuture> answer(InvocationOnMock invo )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.NOT_FOUND); - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.NOT_FOUND); } }); @@ -681,8 +665,7 @@ void TC_08_SendTest_PublishKo() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -691,8 +674,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.CONFLICT); - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.CONFLICT); } }); @@ -734,8 +716,7 @@ void TC_09_SendTest_Update_NotFound() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -775,8 +756,7 @@ public CompletableFuture> answer(InvocationOnMock invo )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseUpdateKo(invocation, HttpStatus.NOT_FOUND); - return mockResponseEntity; + return GpdUtils.creaResponseUpdateKo(invocation, HttpStatus.NOT_FOUND); } }); @@ -814,8 +794,7 @@ void TC_10_SendTest_Update_Conflict() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -855,8 +834,7 @@ public CompletableFuture> answer(InvocationOnMock invo )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseUpdateKo(invocation, HttpStatus.CONFLICT); - return mockResponseEntity; + return GpdUtils.creaResponseUpdateKo(invocation, HttpStatus.CONFLICT); } }); @@ -894,8 +872,7 @@ void TC_11_SendTest_Update_ServiceUnavailable() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -935,8 +912,7 @@ public CompletableFuture> answer(InvocationOnMock invo )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseUpdateKo(invocation, HttpStatus.SERVICE_UNAVAILABLE); - return mockResponseEntity; + return GpdUtils.creaResponseUpdateKo(invocation, HttpStatus.SERVICE_UNAVAILABLE); } }); @@ -974,8 +950,7 @@ void TC_12_SendTest_Update_NotFound_WithException() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -1048,8 +1023,7 @@ void TC_13_SendTest_Update_Conflict_WithException() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -1123,8 +1097,7 @@ void TC_14_SendTest_Update_ServiceUnavailable_WithException() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); diff --git a/src/test/java/it/govpay/gpd/test/UC_3_GdeTest.java b/src/test/java/it/govpay/gpd/test/UC_3_GdeTest.java index d8c4446..c201b57 100644 --- a/src/test/java/it/govpay/gpd/test/UC_3_GdeTest.java +++ b/src/test/java/it/govpay/gpd/test/UC_3_GdeTest.java @@ -100,7 +100,7 @@ class UC_3_GdeTest extends UC_00_BaseTest { HttpResponse gdeMockHttpResponse503; HttpResponse gdeMockHttpResponse400; - private void initailizeJobLauncherTestUtils() throws Exception { + private void initailizeJobLauncherTestUtils() { jobLauncherTestUtils.setJob(job); } @@ -109,6 +109,7 @@ void tearDown() { jobRepositoryTestUtils.removeJobExecutions(); } + @SuppressWarnings("unchecked") @BeforeEach void setUp() throws URISyntaxException, JsonProcessingException { MockitoAnnotations.openMocks(this); @@ -170,8 +171,7 @@ void TC_01_SendTest_GpdOk() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -213,9 +213,7 @@ void TC_02_SendTest_GpdKO() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.SERVICE_UNAVAILABLE); - - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.SERVICE_UNAVAILABLE); } }); @@ -257,8 +255,7 @@ void TC_03_SendTest_Gde400BadRequest_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -299,8 +296,7 @@ void TC_04_SendTest_Gde400BadRequest_WithException() throws Exception { .thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -337,8 +333,7 @@ void TC_05_SendTest_Gde503ServiceUnavailable_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -379,8 +374,7 @@ void TC_06_SendTest_Gde503ServiceUnavailable_WithException() throws Exception { .thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -417,8 +411,7 @@ void TC_07_SendTest_Gde401Unauthorized_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -427,6 +420,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>>() { @Override public CompletableFuture> answer(InvocationOnMock invocation) throws Throwable { + @SuppressWarnings("unchecked") HttpResponse mockHttpResponse401 = Mockito.mock(HttpResponse.class); Mockito.lenient().when(mockHttpResponse401.statusCode()).thenReturn(401); Mockito.lenient().when(mockHttpResponse401.body()).thenReturn(new ByteArrayInputStream(mapper.writeValueAsString(GdeProblemUtils.createProblem401()).getBytes())); @@ -463,8 +457,7 @@ void TC_08_SendTest_Gde401Unauthorized_WithException() throws Exception { .thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -501,8 +494,7 @@ void TC_09_SendTest_Gde403Forbidden_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -511,6 +503,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>>() { @Override public CompletableFuture> answer(InvocationOnMock invocation) throws Throwable { + @SuppressWarnings("unchecked") HttpResponse mockHttpResponse403 = Mockito.mock(HttpResponse.class); Mockito.lenient().when(mockHttpResponse403.statusCode()).thenReturn(403); Mockito.lenient().when(mockHttpResponse403.body()).thenReturn(new ByteArrayInputStream(mapper.writeValueAsString(GdeProblemUtils.createProblem403()).getBytes())); @@ -547,8 +540,7 @@ void TC_10_SendTest_Gde403Forbidden_WithException() throws Exception { .thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -585,8 +577,7 @@ void TC_11_SendTest_Gde404NotFound_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -595,6 +586,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>>() { @Override public CompletableFuture> answer(InvocationOnMock invocation) throws Throwable { + @SuppressWarnings("unchecked") HttpResponse mockHttpResponse404 = Mockito.mock(HttpResponse.class); Mockito.lenient().when(mockHttpResponse404.statusCode()).thenReturn(409); Mockito.lenient().when(mockHttpResponse404.body()).thenReturn(new ByteArrayInputStream(mapper.writeValueAsString(GdeProblemUtils.createProblem404()).getBytes())); @@ -631,8 +623,7 @@ void TC_12_SendTest_Gde404NotFound_WithException() throws Exception { .thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -669,8 +660,7 @@ void TC_13_SendTest_Gde409Conflict_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -679,6 +669,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>>() { @Override public CompletableFuture> answer(InvocationOnMock invocation) throws Throwable { + @SuppressWarnings("unchecked") HttpResponse mockHttpResponse409 = Mockito.mock(HttpResponse.class); Mockito.lenient().when(mockHttpResponse409.statusCode()).thenReturn(409); Mockito.lenient().when(mockHttpResponse409.body()).thenReturn(new ByteArrayInputStream(mapper.writeValueAsString(GdeProblemUtils.createProblem409()).getBytes())); @@ -715,8 +706,7 @@ void TC_14_SendTest_Gde409Conflict_WithException() throws Exception { .thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -753,8 +743,7 @@ void TC_15_SendTest_Gde429TooManyRequests_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -763,6 +752,7 @@ public ResponseEntity answer(InvocationOnMock invocation) )).thenAnswer(new Answer>>() { @Override public CompletableFuture> answer(InvocationOnMock invocation) throws Throwable { + @SuppressWarnings("unchecked") HttpResponse mockHttpResponse403 = Mockito.mock(HttpResponse.class); Mockito.lenient().when(mockHttpResponse403.statusCode()).thenReturn(429); Mockito.lenient().when(mockHttpResponse403.body()).thenReturn(new ByteArrayInputStream(mapper.writeValueAsString(GdeProblemUtils.createProblem429()).getBytes())); @@ -799,8 +789,7 @@ void TC_16_SendTest_Gde429TooManyRequests_WithException() throws Exception { .thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); @@ -838,9 +827,7 @@ void TC_17_SendTest_GpdKO_400BadRequest_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.BAD_REQUEST); - - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.BAD_REQUEST); } }); @@ -920,9 +907,7 @@ void TC_19_SendTest_GpdKO_404NotFound_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.NOT_FOUND); - - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.NOT_FOUND); } }); @@ -1002,9 +987,7 @@ void TC_21_SendTest_GpdKO_409Conflict_WithProblem() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.CONFLICT); - - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.CONFLICT); } }); @@ -1013,9 +996,7 @@ public ResponseEntity answer(InvocationOnMock invocation) throws Th )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseGetPositionOk(invocation, StatusEnum.DRAFT); - - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseGetPositionOk(invocation, StatusEnum.DRAFT); } }); @@ -1024,8 +1005,7 @@ public ResponseEntity answer(InvocationOnMock )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -1072,9 +1052,7 @@ void TC_22_SendTest_GpdKO_409Conflict_WithException() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseGetPositionOk(invocation, StatusEnum.DRAFT); - - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseGetPositionOk(invocation, StatusEnum.DRAFT); } }); @@ -1083,8 +1061,7 @@ public ResponseEntity answer(InvocationOnMock )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponsePublishPositionOk(invocation); } }); @@ -1126,9 +1103,7 @@ void TC_23_SendTest_GpdKO_500InternalServerError_WithProblem() throws Exception )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = GpdUtils.creaResponseKo(invocation, HttpStatus.INTERNAL_SERVER_ERROR); - - return mockResponseEntity; + return GpdUtils.creaResponseKo(invocation, HttpStatus.INTERNAL_SERVER_ERROR); } }); diff --git a/src/test/java/it/govpay/gpd/test/UC_4_GdeFailTest.java b/src/test/java/it/govpay/gpd/test/UC_4_GdeFailTest.java index 817a8eb..4d845d6 100644 --- a/src/test/java/it/govpay/gpd/test/UC_4_GdeFailTest.java +++ b/src/test/java/it/govpay/gpd/test/UC_4_GdeFailTest.java @@ -3,8 +3,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; -import java.net.URISyntaxException; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -31,8 +29,6 @@ import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ActiveProfiles; -import com.fasterxml.jackson.core.JsonProcessingException; - import it.govpay.gpd.Application; import it.govpay.gpd.client.api.DebtPositionsApiApi; import it.govpay.gpd.client.api.impl.ApiClient; @@ -74,7 +70,7 @@ class UC_4_GdeFailTest extends UC_00_BaseTest { @Value("${it.govpay.gpd.batch.dbreader.sogliaTemporaleRicercaPendenze.numeroGiorni:7}") private Integer numeroGiorni; - private void initailizeJobLauncherTestUtils() throws Exception { + private void initailizeJobLauncherTestUtils() { jobLauncherTestUtils.setJob(job); } @@ -84,7 +80,7 @@ void tearDown() { } @BeforeEach - void setUp() throws URISyntaxException, JsonProcessingException { + void setUp() { MockitoAnnotations.openMocks(this); this.cleanDB(); @@ -112,8 +108,7 @@ void TC_01_SendTest_GdeUnknowhost() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); diff --git a/src/test/java/it/govpay/gpd/test/UC_5_NoGdeTest.java b/src/test/java/it/govpay/gpd/test/UC_5_NoGdeTest.java index aa5def8..7198d62 100644 --- a/src/test/java/it/govpay/gpd/test/UC_5_NoGdeTest.java +++ b/src/test/java/it/govpay/gpd/test/UC_5_NoGdeTest.java @@ -3,8 +3,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; -import java.net.URISyntaxException; - import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -31,8 +29,6 @@ import org.springframework.test.annotation.DirtiesContext.ClassMode; import org.springframework.test.context.ActiveProfiles; -import com.fasterxml.jackson.core.JsonProcessingException; - import it.govpay.gpd.Application; import it.govpay.gpd.client.api.DebtPositionsApiApi; import it.govpay.gpd.client.api.impl.ApiClient; @@ -76,7 +72,7 @@ class UC_5_NoGdeTest extends UC_00_BaseTest { @Value("${it.govpay.gpd.batch.dbreader.sogliaTemporaleRicercaPendenze.numeroGiorni:7}") private Integer numeroGiorni; - private void initailizeJobLauncherTestUtils() throws Exception { + private void initailizeJobLauncherTestUtils() { jobLauncherTestUtils.setJob(job); } @@ -86,7 +82,7 @@ void tearDown() { } @BeforeEach - void setUp() throws URISyntaxException, JsonProcessingException { + void setUp() { MockitoAnnotations.openMocks(this); this.cleanDB(); @@ -114,8 +110,7 @@ void TC_01_SendTest_NoGde() throws Exception { )).thenAnswer(new Answer>() { @Override public ResponseEntity answer(InvocationOnMock invocation) throws Throwable { - ResponseEntity mockResponseEntity = PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); - return mockResponseEntity; + return PaymentPositionModelUtils.creaResponseCreatePaymentPositionModelOk(invocation); } }); diff --git a/src/test/java/it/govpay/gpd/test/entity/SingoloVersamentoFullEntity.java b/src/test/java/it/govpay/gpd/test/entity/SingoloVersamentoFullEntity.java index 2de9e4d..79c1e3d 100644 --- a/src/test/java/it/govpay/gpd/test/entity/SingoloVersamentoFullEntity.java +++ b/src/test/java/it/govpay/gpd/test/entity/SingoloVersamentoFullEntity.java @@ -5,8 +5,6 @@ import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; import jakarta.persistence.Id; -import jakarta.persistence.JoinColumn; -import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -83,9 +81,6 @@ public enum StatoSingoloVersamento { @Column(name = "metadata") private String metadata; -// @ManyToOne -// @JoinColumn(name = "id_versamento", nullable = false) -// private VersamentoFullEntity versamento; } diff --git a/src/test/java/it/govpay/gpd/test/entity/TributoEntity.java b/src/test/java/it/govpay/gpd/test/entity/TributoEntity.java index 43a0b97..15bd3b9 100644 --- a/src/test/java/it/govpay/gpd/test/entity/TributoEntity.java +++ b/src/test/java/it/govpay/gpd/test/entity/TributoEntity.java @@ -35,19 +35,11 @@ public class TributoEntity { @Column(name = "id_iban_appoggio") private Long idIbanAppoggio; - - -// @Column(name = "id_tipo_tributo", nullable = false) -// private long idTipoTributo; @ManyToOne @JoinColumn(name = "id_tipo_tributo", nullable = false) private TipoTributoEntity tipoTributo; - -// @Column(name = "id_dominio", nullable = false) -// private long idDominio; - @ManyToOne @JoinColumn(name = "id_dominio", nullable = false) private DominioEntity dominio; diff --git a/src/test/java/it/govpay/gpd/test/entity/VersamentoFullEntity.java b/src/test/java/it/govpay/gpd/test/entity/VersamentoFullEntity.java index e087322..d311466 100644 --- a/src/test/java/it/govpay/gpd/test/entity/VersamentoFullEntity.java +++ b/src/test/java/it/govpay/gpd/test/entity/VersamentoFullEntity.java @@ -1,16 +1,13 @@ package it.govpay.gpd.test.entity; import java.time.OffsetDateTime; -import java.util.Set; import it.govpay.gpd.entity.VersamentoGpdEntity.TIPO; -import jakarta.persistence.CascadeType; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.EnumType; import jakarta.persistence.Enumerated; import jakarta.persistence.Id; -import jakarta.persistence.OneToMany; import jakarta.persistence.Table; import lombok.AllArgsConstructor; import lombok.Builder; @@ -115,7 +112,4 @@ public class VersamentoFullEntity { @Column(name = "data_ultima_comunicazione_aca") private OffsetDateTime dataUltimaComunicazioneAca; - -// @OneToMany(mappedBy = "versamento", cascade = CascadeType.PERSIST) -// private Set singoliVersamenti; } diff --git a/src/test/java/it/govpay/gpd/test/utils/GpdUtils.java b/src/test/java/it/govpay/gpd/test/utils/GpdUtils.java index 185778d..c9d0d08 100644 --- a/src/test/java/it/govpay/gpd/test/utils/GpdUtils.java +++ b/src/test/java/it/govpay/gpd/test/utils/GpdUtils.java @@ -74,8 +74,7 @@ public static ResponseEntity creaResponseKo(String xRequestId, Http throw new IllegalArgumentException("Unexpected value: " + httpStatus); } - ResponseEntity mockResponseEntity = new ResponseEntity<>(response, getHeadersProblem(xRequestId), httpStatus); - return mockResponseEntity; + return new ResponseEntity<>(response, getHeadersProblem(xRequestId), httpStatus); } private static ProblemJson createProblemFromOpenAPI(String title, String detail, int status, String type) throws URISyntaxException { @@ -83,7 +82,6 @@ private static ProblemJson createProblemFromOpenAPI(String title, String detail, problem.setStatus(status); problem.setTitle(title); problem.setDetail(detail); -// problem.setType(new URI(type)); return problem; } diff --git a/src/test/java/it/govpay/gpd/test/utils/PaymentPositionModelUtils.java b/src/test/java/it/govpay/gpd/test/utils/PaymentPositionModelUtils.java index 6a96b20..12ae93f 100644 --- a/src/test/java/it/govpay/gpd/test/utils/PaymentPositionModelUtils.java +++ b/src/test/java/it/govpay/gpd/test/utils/PaymentPositionModelUtils.java @@ -24,8 +24,7 @@ public static ResponseEntity creaResponseGetPo response.setIupd(iupd); response.setStatus(statusEnum); - ResponseEntity mockResponseEntity = new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); - return mockResponseEntity; + return new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); } public static ResponseEntity creaResponsePublishPositionOk(InvocationOnMock invocation) { @@ -37,8 +36,7 @@ public static ResponseEntity creaResponsePublishPositionOk response.setFiscalCode(codDominio); response.setIupd(iupd); - ResponseEntity mockResponseEntity = new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); - return mockResponseEntity; + return new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); } public static ResponseEntity creaResponseInvalidatePositionOk(InvocationOnMock invocation) { @@ -50,8 +48,7 @@ public static ResponseEntity creaResponseInvalidatePositio response.setFiscalCode(codDominio); response.setIupd(iupd); - ResponseEntity mockResponseEntity = new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); - return mockResponseEntity; + return new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); } public static ResponseEntity creaResponseCreatePaymentPositionModelOk(InvocationOnMock invocation) { @@ -62,8 +59,7 @@ public static ResponseEntity creaResponseCreatePaymentPosi PaymentPositionModel response = PaymentPositionModelUtils.createPaymentPositionModelResponse(paymentPositionModel, null, status); - ResponseEntity mockResponseEntity = new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.CREATED); - return mockResponseEntity; + return new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.CREATED); } public static ResponseEntity creaResponseUpdatePaymentPositionModelOk(InvocationOnMock invocation) { @@ -74,8 +70,7 @@ public static ResponseEntity creaResponseUpdatePaymentPosi PaymentPositionModel response = PaymentPositionModelUtils.createPaymentPositionModelResponse(paymentPositionModel, null, status); - ResponseEntity mockResponseEntity = new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); - return mockResponseEntity; + return new ResponseEntity<>(response, GpdUtils.getHeadersCreatedOk(xRequestId), HttpStatus.OK); } public static StatusEnum getStatus(Boolean toPublish, OffsetDateTime validityDate) { diff --git a/src/test/java/it/govpay/gpd/test/utils/VersamentoUtils.java b/src/test/java/it/govpay/gpd/test/utils/VersamentoUtils.java index 99c4306..b32c1e8 100644 --- a/src/test/java/it/govpay/gpd/test/utils/VersamentoUtils.java +++ b/src/test/java/it/govpay/gpd/test/utils/VersamentoUtils.java @@ -351,6 +351,7 @@ public static void generaMetadata(ObjectMapper objectMapper, SingoloVersamentoFu try { singoloVersamentoFullEntity.setMetadata(objectMapper.writeValueAsString(metadata)); } catch (JsonProcessingException e) { + //donothing } } @@ -414,8 +415,7 @@ public static String generaIUVISO11694(long prg, String prefix) throws IuvExcept throw new IuvException("Superato il numero massimo di IUV generabili Prefisso:"+prefix+"]" ); String check = IuvUtils.getCheckDigit(reference); - String iuv = "RF" + check + reference; - return iuv; + return "RF" + check + reference; } public static String generaIUVNumerico(long prg, String prefix) throws IuvException { @@ -423,8 +423,6 @@ public static String generaIUVNumerico(long prg, String prefix) throws IuvExcept if(reference.length() > 15) throw new IuvException("Superato il numero massimo di IUV generabili Prefisso:"+prefix+"]" ); String check = IuvUtils.getCheckDigit93(reference, 0, 1); - String iuv = reference + check; - - return iuv; + return reference + check; } }