public void send(SlackMessage message, String webhookUrl) throws TemporaryEventNotificationException,
            PermanentEventNotificationException, JsonProcessingException {

        final Request request = new Request.Builder()
                .url(webhookUrl)
                .post(RequestBody.create(MediaType.parse(APPLICATION_JSON), objectMapper.writeValueAsString(message)))
                .build();

        LOG.debug("Posting to webhook url <{}> the payload is <{}>",
                webhookUrl,
                "");

        try (final Response r = httpClient.newCall(request).execute()) {
            if (!r.isSuccessful()) {
                //ideally this should not happen and the user is expected to fill the
                //right configuration , while setting up a notification
                throw new PermanentEventNotificationException(
                        "Expected successful HTTP response [2xx] but got [" + r.code() + "]. " + webhookUrl);
            }
        } catch (IOException e) {
            throw new TemporaryEventNotificationException("Unable to send the slack Message. " + e.getMessage());
        }
    }
@Test
    public void sendsHttpRequestAsExpected_whenInputIsGood() throws Exception {
        server.enqueue(new MockResponse().setResponseCode(200));

        SlackClient slackClient = new SlackClient(httpClient, objectMapper);
        slackClient.send(getMessage(), server.url("/").toString());

        final RecordedRequest recordedRequest = server.takeRequest();

        assertThat(recordedRequest.getMethod()).isEqualTo("POST");
        assertThat(recordedRequest.getBody()).isNotNull();
        assertThat(recordedRequest.getBody().readUtf8()).isEqualTo(objectMapper.writeValueAsString(getMessage()));
    }