TeamsMessage createTeamsMessage(EventNotificationContext ctx, TeamsEventNotificationConfig config) throws PermanentEventNotificationException {
        String messageTitle = buildDefaultMessage(ctx);
        String description = buildMessageDescription(ctx);
        String customMessage = null;
        String template = config.customMessage();
        String summary = ctx.eventDefinition().map(EventDefinitionDto::title).orElse("Graylog Event");
        if (!isNullOrEmpty(template)) {
            customMessage = buildCustomMessage(ctx, config, template);
        }

        TeamsMessage.Sections section = TeamsMessage.Sections.builder()
                .activityImage(config.iconUrl())
                .activitySubtitle(description)
                .text(customMessage)
                .build();

        return TeamsMessage.builder()
                .color(config.color())
                .text(messageTitle)
                .summary(summary)
                .sections(Collections.singleton(section))
                .build();
    }
@Test
    public void createTeamsMessage() throws EventNotificationException {
        String expectedText = "**Alert Event Definition Test Title triggered:**\n";
        String expectedSubtitle = "_Event Definition Test Description_";
        TeamsMessage actual = teamsEventNotification.createTeamsMessage(eventNotificationContext, teamsEventNotificationConfig);
        assertThat(actual.type()).isEqualTo(TeamsMessage.VALUE_TYPE);
        assertThat(actual.context()).isEqualTo(TeamsMessage.VALUE_CONTEXT);
        assertThat(actual.color()).isEqualTo(expectedColor);
        assertThat(actual.text()).isEqualTo(expectedText);
        assertThat(actual.sections().size()).isEqualTo(1);
        TeamsMessage.Sections section = actual.sections().iterator().next();
        assertThat(section.activitySubtitle()).isEqualTo(expectedSubtitle);
        assertThat(section.activityImage()).isEqualTo(expectedImage);
        assertThat(section.text().contains("a custom message")).isTrue();
    }