package io.ljunggren.url.utils;

import static org.junit.Assert.*;

import java.io.UnsupportedEncodingException;

import org.junit.Test;

public class UrlUtilsTest {

    @Test
    public void encodeTest() throws UnsupportedEncodingException {
        String expected = "https%3A%2F%2Fljunggren.io";
        String actual = UrlUtils.encode("https://ljunggren.io");
        assertEquals(expected, actual);
    }
    
    @Test
    public void encodeNullTest() throws UnsupportedEncodingException {
        String actual = UrlUtils.encode(null);
        assertNull(actual);
    }

    @Test
    public void decodeTest() throws UnsupportedEncodingException {
        String expected = "https://ljunggren.io";
        String actual = UrlUtils.decode("https%3A%2F%2Fljunggren.io");
        assertEquals(expected, actual);
    }

    @Test
    public void decodeNullTest() throws UnsupportedEncodingException {
        String actual = UrlUtils.decode(null);
        assertNull(actual);
    }
    
}
