void shouldSaveTemplate()

in ddm-notification-service/src/it/java/com/epam/digital/data/platform/notification/controller/NotificationTemplateControllerTest.java [76:107]


  void shouldSaveTemplate(String channel) throws Exception {
    var title = "Title";
    var content = "<html><h1>Hello</h1></html>";
    var inputDto = new SaveNotificationTemplateInputDto();
    inputDto.setTitle(title);
    inputDto.setContent(content);
    inputDto.setAttributes(
        Collections.singletonList(new NotificationTemplateAttributeDto("name", "value")));
    mockMvc
        .perform(
            put(BASE_URL + String.format("/%s:template", channel))
                .header("X-Access-Token", TOKEN)
                .contentType(MediaType.APPLICATION_JSON)
                .content(objectMapper.writeValueAsString(inputDto)))
        .andExpectAll(
            status().isOk(),
            content().contentType(MediaType.APPLICATION_JSON),
            jsonPath("$.name", is("template")),
            jsonPath("$.channel", is(channel)),
            jsonPath("$.title", is(title)),
            jsonPath("$.content", is(content)),
            jsonPath("$.checksum", is(DigestUtils.sha256Hex(content))),
            jsonPath("$.attributes[0].name", is("name")),
            jsonPath("$.attributes[0].value", is("value")),
            jsonPath("$.createdAt", notNullValue()),
            jsonPath("$.updatedAt", notNullValue()),
            jsonPath("$.externalTemplateId", nullValue()),
            jsonPath("$.externallyPublishedAt", nullValue()));

    var dbContent = notificationTemplateRepository.findByNameAndChannel("template", channel);
    assertThat(dbContent).isNotEmpty();
  }