@Transactional
    public Spending updateSpending(Long spendingId, SpendingReq request) {
        Spending spending = spendingService.readSpending(spendingId).orElseThrow(() -> new SpendingErrorException(SpendingErrorCode.NOT_FOUND_SPENDING));

        SpendingCustomCategory customCategory = (request.isCustomCategory())
                ? spendingCustomCategoryService.readSpendingCustomCategory(request.categoryId()).orElseThrow(() -> new SpendingErrorException(SpendingErrorCode.NOT_FOUND_CUSTOM_CATEGORY))
                : null;

        spending.update(request.amount(), request.icon(), request.spendAt().atStartOfDay(), request.accountName(), request.memo(), customCategory);

        return spending;
    }
@DisplayName("없는 사용자 정의 카테고리로 지출 내역을 수정하려고 할 때 SpendingErrorException을 발생시킨다.")
    @Test
    void testUpdateSpendingWithCustomCategoryNotFound() {
        // given
        Long spendingId = 1L;
        given(spendingService.readSpending(spendingId)).willReturn(Optional.of(spending));
        given(spendingCustomCategoryService.readSpendingCustomCategory(1L)).willReturn(Optional.empty());

        // when - then
        SpendingErrorException exception = assertThrows(SpendingErrorException.class, () -> {
            spendingUpdateService.updateSpending(spendingId, requestWithCustomCategory);
        });
        log.debug(exception.getExplainError());
    }