@Transactional
    public void update(MemberDto memberDto, Long templateId, UpdateTemplateRequest updateTemplateRequest) {
        Member member = memberRepository.fetchById(memberDto.id());
        Category category = categoryRepository.fetchById(updateTemplateRequest.categoryId());
        validateCategoryAuthorizeMember(category, member);
        Template template = templateRepository.fetchById(templateId);
        validateTemplateAuthorizeMember(template, member);

        template.updateTemplate(updateTemplateRequest.title(), updateTemplateRequest.description(), category);
        updateSourceCodes(updateTemplateRequest, template);
        updateTags(updateTemplateRequest, template);
        validateSourceCodesCount(updateTemplateRequest, template);
    }
@Test
    @DisplayName("템플릿 수정 성공")
    void updateTemplateSuccess() {
        // given
        MemberDto memberDto = MemberDtoFixture.getFirstMemberDto();
        Member member = memberRepository.fetchById(memberDto.id());
        CreateTemplateRequest createdTemplate = makeTemplateRequest("title");
        Template template = saveTemplate(createdTemplate, new Category("category1", member), member);
        categoryRepository.save(new Category("category2", member));

        // when
        UpdateTemplateRequest updateTemplateRequest = makeUpdateTemplateRequest(1L);
        templateService.update(memberDto, template.getId(), updateTemplateRequest);
        Template updateTemplate = templateRepository.fetchById(template.getId());
        List<SourceCode> sourceCodes = sourceCodeRepository.findAllByTemplate(template);
        Thumbnail thumbnail = thumbnailRepository.fetchById(template.getId());
        List<Tag> tags = templateTagRepository.findAllByTemplate(updateTemplate).stream()
                .map(TemplateTag::getTag)
                .toList();

        // then
        assertAll(
                () -> assertThat(updateTemplate.getTitle()).isEqualTo("updateTitle"),
                () -> assertThat(thumbnail.getSourceCode().getId()).isEqualTo(2L),
                () -> assertThat(sourceCodes).hasSize(3),
                () -> assertThat(updateTemplate.getCategory().getId()).isEqualTo(1L),
                () -> assertThat(tags).hasSize(2),
                () -> assertThat(tags.get(1).getName()).isEqualTo("tag3")
        );
    }