package org.trello4j;

import static org.junit.Assert.assertEquals;

import org.junit.Test;
import org.trello4j.model.Action;


/**
 * Created with IntelliJ IDEA.
 * User: joel
 * Date: 2012-04-15
 * Time: 11:00 AM
 */
public class TrelloURLTest {

    /**
     * Should build url with filter.
     *
     * @throws Exception the exception
     */
    @Test
    public void shouldBuildURLWithFilter() throws Exception {
        String url = TrelloURL.create("API_KEY", TrelloURL.ACTION_URL, "ID")
                .token("TOKEN")
                .filter(Action.TYPE.ADD_ATTACHMENT, Action.TYPE.ADD_CHECKLIST)
                .build();

        String expectedUrl = "https://api.trello.com/1/actions/ID?key=API_KEY&token=TOKEN&filter=" + Action.TYPE.ADD_ATTACHMENT + "," + Action.TYPE.ADD_CHECKLIST;

        assertEquals(expectedUrl, url);
    }
}

@@ -837,11 +837,290 @@
 );%0A    %7D
+%0A%0A%09@Test%0A%09public void shouldNotReturnNullBaseURL() %7B%0A%09%09String url = TrelloURL%0A%09%09%09%09.create(%22API_KEY%22, TrelloURL.CARD_POST_URL)%0A%09%09%09%09.token(%22TOKEN%22)%0A%09%09%09%09.build();%0A%0A%09%09String expectedUrl = %22https://api.trello.com/1/cards?key=API_KEY&token=TOKEN%22;%0A%0A%09%09assertEquals(expectedUrl, url);%0A%09%7D
 %0A%7D%0A

Test for API url's without path parameters.