public void createCredit(CreditCreateRequest request, String identificationNumber) {
        Credit credit = creditRepository.save(Credit.builder()
                .amount(request.getAmount())
                .status(CreditStatus.STARTED)
                .identificationNumber(identificationNumber)
                .build());

        BigDecimal installmentAmount = request.getAmount().divide(BigDecimal.valueOf(request.getInstallmentCount()));

        // Calculate installment due dates and publish events
        createInstallments(credit, installmentAmount, request.getInstallmentCount());

        // Publish credit creation event
        eventPublisherService.publishCredit(getCreditDocumentFromCredit(credit));
    }
@Test
    void createCredit() {
        // Arrange
        CreditCreateRequest request = new CreditCreateRequest(BigDecimal.valueOf(1000), 5);
        String identificationNumber = "1234567890";
        Credit credit = Credit.builder()
                .id(1)
                .amount(request.getAmount())
                .status(CreditStatus.STARTED)
                .identificationNumber(identificationNumber)
                .build();
        Installment installment = Installment.builder()
                .id(1)
                .amount(BigDecimal.valueOf(200))
                .status(InstallmentStatus.UNPAID)
                .dueDate(LocalDateTime.now())
                .credit(credit)
                .build();
        when(creditRepository.save(any())).thenReturn(credit);
        when(installmentRepository.save(any())).thenReturn(installment);

        // Act
        creditService.createCredit(request, identificationNumber);

        // Assert
        verify(creditRepository, times(1)).save(any(Credit.class));
        verify(eventPublisherService, times(1)).publishCredit(any(CreditDocument.class));
    }