package org.ccguyka;


import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.github.tomakehurst.wiremock.matching.ContainsPattern;
import org.junit.Rule;
import org.junit.Test;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;

public class SlackerTest {

    @Rule
    public WireMockRule wireMockRule = new WireMockRule(options().port(9999));

    @Test
    public void verifyMessageIsSent() {
        stubFor(post(urlEqualTo("/webhook"))
                .willReturn(aResponse()
                        .withBody("ok!")));


        Slacker slacker = new Slacker(new Message("http://localhost:9999/webhook", "message"));

        slacker.send();

        verify(postRequestedFor(urlEqualTo("/webhook"))
                .withRequestBody(new ContainsPattern("message")));
    }
}

@@ -884,11 +884,1303 @@
 );%0A    %7D
+%0A%0A    @Test%0A    public void verifyMessageIsSentInMainMethod() throws Exception %7B%0A        stubFor(post(urlEqualTo(%22/webhook%22))%0A                .willReturn(aResponse()%0A                        .withBody(%22ok!%22)));%0A%0A        Slacker.main(new String%5B%5D%7B%22-hk%22, %22http://localhost:9999/webhook%22, %22-m%22, %22message%22%7D);%0A%0A        verify(postRequestedFor(urlEqualTo(%22/webhook%22))%0A                .withRequestBody(new ContainsPattern(%22message%22)));%0A    %7D%0A%0A    @Test%0A    public void verifyMessageIsNotSentIfMandatoryParameterIsMissing() throws Exception %7B%0A        stubFor(post(urlEqualTo(%22/webhook%22))%0A                .willReturn(aResponse()%0A                        .withBody(%22ok!%22)));%0A%0A        Slacker.main(new String%5B0%5D);%0A%0A        verify(0, postRequestedFor(urlEqualTo(%22/webhook%22))%0A                .withRequestBody(new ContainsPattern(%22message%22)));%0A    %7D%0A%0A    @Test%0A    public void verifyMessageIsNotSentIfHelpParemeterIsSpecified() throws Exception %7B%0A        stubFor(post(urlEqualTo(%22/webhook%22))%0A                .willReturn(aResponse()%0A                        .withBody(%22ok!%22)));%0A%0A        Slacker.main(new String%5B%5D%7B%22-hk%22, %22http://localhost:9999/webhook%22, %22-m%22, %22message%22, %22-h%22%7D);%0A%0A        verify(0, postRequestedFor(urlEqualTo(%22/webhook%22))%0A                .withRequestBody(new ContainsPattern(%22message%22)));%0A    %7D
 %0A%7D%0A

write some tests for slacker main method