void expectTemplateIsUpdatedIfNewContent()

in ddm-notification-service/src/it/java/com/epam/digital/data/platform/notification/service/SaveDefaultNotificationTemplateServiceTest.java [85:114]


  void expectTemplateIsUpdatedIfNewContent() {
    var prepopulatedEntity =
        notificationTemplateRepository.save(createTemplate("<html><h1>Hello</h1></html>"));
    var inputDto =
            SaveNotificationTemplateInputDto.builder()
                    .title(TITLE)
                    .content("<html><h1>Updated content</h1></html>")
                    .build();

    service.save("email", "template", inputDto);

    var templateTableContent = notificationTemplateRepository
            .findByNameAndChannel("template", "email").get();
    assertThat(templateTableContent).isNotNull();
    assertThat(templateTableContent.getId()).isEqualTo(prepopulatedEntity.getId());
    assertThat(templateTableContent.getChannel()).isEqualTo(CHANNEL);
    assertThat(templateTableContent.getName()).isEqualTo(NAME);
    assertThat(templateTableContent.getTitle()).isEqualTo(TITLE);
    assertThat(templateTableContent.getContent()).isEqualTo("<html><h1>Updated content</h1></html>");
    assertThat(templateTableContent.getChecksum())
            .isEqualTo("c7028d4e3a2f4cf10322fc39c84af41f0be397b63cc3a4f1b76867a29bf9ab8f");
    assertThat(templateTableContent.getCreatedAt()).isNotNull();
    assertThat(templateTableContent.getUpdatedAt()).isNotNull();
    assertThat(templateTableContent.getExtTemplateId()).isNull();
    assertThat(templateTableContent.getExtPublishedAt()).isNull();

    var attributesTableContent =
            notificationTemplateAttributeRepository.findByTemplateId(templateTableContent.getId());
    assertThat(attributesTableContent).isEmpty();
  }