package com.github.kennedyoliveira.pastebin4j.api;

import org.junit.Test;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.*;

/**
 * @author Kennedy Oliveira
 */
public class PasteUtilTest {

    @Test
    public void testGetPasteKeyFromUrl() throws Exception {

        final String pasteBinUrl = "http://pastebin.com/NCSQ6k9N";

        assertThat("NCSQ6k9N", is(equalTo(PasteUtil.getPasteKeyFromUrl(pasteBinUrl))));
    }

    @Test
    public void testGetPasteKeyFromUrlNullCase() throws Exception {
        assertThat(PasteUtil.getPasteKeyFromUrl(null), is(nullValue()));
    }

    @Test
    public void testGetPasteKeyFromInvalidUrl() throws Exception {
        try {
            PasteUtil.getPasteKeyFromUrl("http//google.com");
            fail("Should throwed IllegalArgumentException");
        } catch (Exception e) {
        }

    }
}
@@ -425,16 +425,17 @@
  = %22http
+s
 ://paste
@@ -971,8 +971,9 @@
 %0A    %7D%0A%7D
+%0A

Fix tests to use HTTPS.