package com.eyolas.http.query;

import com.eyolas.http.query.pojo.ObjectEmpty;
import org.junit.Assert;
import org.junit.Test;

/**
 *
 * @author eyolas
 */
public class UriQueryBuilderTest {
   
    @Test
    public void simpleTest() {
        UriQueryBuilder builder = new UriQueryBuilder().param("test", "simpleTest");
        Assert.assertEquals("?test=simpleTest", builder.build());
    }
    
    @Test
    public void simpleTest2() {
        UriQueryBuilder builder = new UriQueryBuilder()
                .param("test", "simpleTest")
                .param("object", new ObjectEmpty());
        Assert.assertEquals("?test=simpleTest&object=ObjectEmpty{}", builder.build());
    }
    
    @Test
    public void valueEmpty() {
        UriQueryBuilder builder = new UriQueryBuilder()
                .param("test", "simpleTest")
                .param("object", null)
                .param("test2", "lol");
        Assert.assertEquals("?test=simpleTest&object=&test2=lol", builder.build());
    }
    
    @Test
    public void keyEmpty() {
        UriQueryBuilder builder = new UriQueryBuilder()
                .param("test", "simpleTest")
                .param(null, "test")
                .param("", "lol");
        Assert.assertEquals("?test=simpleTest", builder.build());
    }
}

@@ -72,16 +72,64 @@
 tEmpty;%0A
+import java.util.Arrays;%0Aimport java.util.List;%0A
 import o
@@ -1334,10 +1334,290 @@
 ;%0A    %7D%0A
+    %0A    @Test%0A    public void array() %7B%0A        List%3CString%3E list = Arrays.asList(%22test%22, %22lol%22, %22titi%22);%0A        UriQueryBuilder builder = new UriQueryBuilder()%0A                .param(%22list%22, list);%0A        Assert.assertEquals(%22?list=%5Btest, lol, titi%5D%22, builder.build());%0A    %7D%0A
 %7D%0A

add test