void expectNewTemplateIsCreatedIfNotExists()

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


  void expectNewTemplateIsCreatedIfNotExists() {
    var inputDto =
        SaveNotificationTemplateInputDto.builder()
            .title(TITLE)
            .content("<html><h1>Hello</h1></html>")
            .build();

    service.save(CHANNEL, NAME, inputDto);

    var templateTableContent = notificationTemplateRepository
            .findByNameAndChannel(NAME, CHANNEL).get();
    assertThat(templateTableContent).isNotNull();
    assertThat(templateTableContent.getId()).isNotNull();
    assertThat(templateTableContent.getChannel()).isEqualTo(CHANNEL);
    assertThat(templateTableContent.getName()).isEqualTo(NAME);
    assertThat(templateTableContent.getTitle()).isEqualTo(TITLE);
    assertThat(templateTableContent.getContent()).isEqualTo("<html><h1>Hello</h1></html>");
    assertThat(templateTableContent.getChecksum())
        .isEqualTo("40c6d08f4bbd1fe4ac7f66239a7ca777dc7b0c449d4b459c523ad9eefab54abc");
    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();
  }