Browse souce code repository at: https://github.com/jjYBdx4IL/java-evaluation/blob/master/src/test/java/org/apache/http/client/URIBuilderTest.java
/*
 * #%L
 * Evaluation
 * %%
 * Copyright (C) 2016 Github jjYBdx4IL Projects
 * %%
 * #L%
 */
package org.apache.http.client;

import java.net.MalformedURLException;
import java.net.URISyntaxException;

import org.apache.http.client.utils.URIBuilder;
import static org.junit.Assert.*;
import org.junit.Test;

/**
 *
 * @author Github jjYBdx4IL Projects
 */
public class URIBuilderTest {

    @Test
    public void test1() throws URISyntaxException, MalformedURLException {
        URIBuilder b = new URIBuilder();
        b.setHost("host.com");
        b.setScheme("http");
        b.addParameter("a", " ");
        b.addParameter("a", " ");
        assertEquals("http://host.com?a=+&a=+", b.toString());
        assertEquals("http://host.com?a=+&a=+", b.build().toString());
        assertEquals("http://host.com?a=+&a=+", b.build().toURL().toExternalForm());
    }

    @Test
    public void test2() throws URISyntaxException, MalformedURLException {
        URIBuilder b = new URIBuilder("http://host.com?a=+");
        b.addParameter("a", " ");
        assertEquals("http://host.com?a=+&a=+", b.toString());
        assertEquals("http://host.com?a=+&a=+", b.build().toString());
        assertEquals("http://host.com?a=+&a=+", b.build().toURL().toExternalForm());
    }
}
-------------------------------------------------------------------------------
Test set: org.apache.http.client.URIBuilderTest
-------------------------------------------------------------------------------
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in org.apache.http.client.URIBuilderTest
test1  Time elapsed: 0 s
test2  Time elapsed: 0 s