public CreditResponse getCreditInstallments(String identificationNumber, int creditId) {
        CreditDocument creditDocument = elasticCreditRepository.findByIdAndIdentificationNumber(creditId, identificationNumber).orElseThrow(() -> createCreditNotFoundException(creditId));
        List<InstallmentDocument> installmentDocuments = elasticInstallmentRepository.findByCreditId(creditDocument.getId()).orElseThrow(() -> createInstallmentNotFoundException(creditDocument.getId() ));
        return CreditResponse.builder()
                .id(creditDocument.getId())
                .amount(creditDocument.getAmount())
                .status(creditDocument.getStatus())
                .installments(installmentDocuments.stream()
                        .map(installment -> InstallmentResponse.builder()
                                .id(installment.getId())
                                .amount(installment.getAmount())
                                .status(installment.getStatus())
                                .dueDate(LocalDateTime.ofInstant(Instant.ofEpochMilli(installment.getDueDate()), TimeZone.getDefault().toZoneId()))
                                .build())
                        .toList())
                .build();
    }
@Test
    void getCreditInstallments() {
        // Arrange
        String identificationNumber = "1234567890";
        int creditId = 1;
        CreditDocument creditDocument = CreditDocument.builder()
                .id(creditId)
                .amount(BigDecimal.valueOf(1000))
                .status(CreditStatus.STARTED)
                .identificationNumber(identificationNumber)
                .build();
        InstallmentDocument installmentDocument = InstallmentDocument.builder()
                .id(1)
                .amount(BigDecimal.valueOf(200))
                .status(InstallmentStatus.UNPAID)
                .dueDate(Instant.now().toEpochMilli())
                .creditId(creditId)
                .build();
        List<InstallmentDocument> installmentDocuments = new ArrayList<>();
        installmentDocuments.add(installmentDocument);
        when(elasticCreditRepository.findByIdAndIdentificationNumber(creditId, identificationNumber)).thenReturn(Optional.of(creditDocument));
        when(elasticInstallmentRepository.findByCreditId(creditId)).thenReturn(Optional.of(installmentDocuments));

        // Act
        CreditResponse creditResponse = creditService.getCreditInstallments(identificationNumber, creditId);

        // Assert
        assertEquals(creditDocument.getId(), creditResponse.getId());
        assertEquals(creditDocument.getAmount(), creditResponse.getAmount());
        assertEquals(creditDocument.getStatus(), creditResponse.getStatus());
        assertEquals(1, creditResponse.getInstallments().size());
        assertEquals(installmentDocument.getId(), creditResponse.getInstallments().get(0).getId());
        assertEquals(installmentDocument.getAmount(), creditResponse.getInstallments().get(0).getAmount());
        assertEquals(installmentDocument.getStatus(), creditResponse.getInstallments().get(0).getStatus());
        assertEquals(LocalDateTime.ofInstant(Instant.ofEpochMilli(installmentDocument.getDueDate()), TimeZone.getDefault().toZoneId()), creditResponse.getInstallments().get(0).getDueDate());
    }