void expectTemplateAttributesCreated()

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


  void expectTemplateAttributesCreated() {
    var prepopulatedTemplate =
            notificationTemplateRepository.save(createTemplate("<html><h1>Hello</h1></html>"));
    var inputDto =
            SaveNotificationTemplateInputDto.builder()
                    .title(TITLE)
                    .content("<html><h1>Hello</h1></html>")
                    .attributes(Collections.singletonList(new NotificationTemplateAttributeDto("name", "value")))
                    .build();

    service.save(CHANNEL, NAME, inputDto);

    var templateTableContent = notificationTemplateRepository
            .findByNameAndChannel(NAME, CHANNEL).get();
    assertThat(templateTableContent).isNotNull();
    assertThat(templateTableContent.getId()).isEqualTo(prepopulatedTemplate.getId());
    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).hasSize(1);
    assertThat(attributesTableContent.get(0).getId()).isNotNull();
    assertThat(attributesTableContent.get(0).getTemplateId()).isEqualTo(prepopulatedTemplate.getId());
    assertThat(attributesTableContent.get(0).getName()).isEqualTo("name");
    assertThat(attributesTableContent.get(0).getValue()).isEqualTo("value");
  }