<commit_before>package org.togglz.slack.sender;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockserver.client.MockServerClient;
import org.mockserver.junit.jupiter.MockServerExtension;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
import org.togglz.slack.notification.NotificationFixture;

import static org.togglz.slack.notification.NotificationFixture.exampleNotification;

@ExtendWith(MockServerExtension.class)
class AsyncNotifierIntegrationTest {

    @Test
    void shouldSendNotificationToSlack(MockServerClient server) {
        server.when(HttpRequest.request("/slack")
                .withMethod("POST")
                .withHeader("Content-Type", "application/json")
        ).respond(HttpResponse.response().withStatusCode(200));

        NotificationSender notifier = new AsyncNotifier("http://localhost:" + server.getPort() + "/slack");

        notifier.send(exampleNotification());

        server.verify(HttpRequest.request("/slack")
                .withBody(NotificationFixture.exampleNotificationAsJson()));
    }
}<commit_msg>give sender 500 msecs to send the message before verifying on the receiving end<commit_after>package org.togglz.slack.sender;

import static org.togglz.slack.notification.NotificationFixture.exampleNotification;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockserver.client.MockServerClient;
import org.mockserver.junit.jupiter.MockServerExtension;
import org.mockserver.model.HttpRequest;
import org.mockserver.model.HttpResponse;
import org.togglz.slack.notification.NotificationFixture;

@ExtendWith(MockServerExtension.class)
class AsyncNotifierIntegrationTest {

    @Test
    void shouldSendNotificationToSlack(MockServerClient server) throws InterruptedException {
        server.when(HttpRequest.request("/slack")
                .withMethod("POST")
                .withHeader("Content-Type", "application/json")
        ).respond(HttpResponse.response().withStatusCode(200));

        NotificationSender notifier = new AsyncNotifier("http://localhost:" + server.getPort() + "/slack");

        notifier.send(exampleNotification());

        Thread.sleep(500);

        server.verify(HttpRequest.request("/slack")
                .withBody(NotificationFixture.exampleNotificationAsJson()));
    }
}
{'fraction_non_alphanumeric': 0.11083333333333334, 'fraction_numerical': 0.005, 'mean_word_length': 4.4198645598194135, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3143374', 'n_tokens_mistral': 678, 'n_tokens_neox': 658, 'n_words': 96}