// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/ElementNotFoundException.java
// public class ElementNotFoundException extends RuntimeException {
//     public ElementNotFoundException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/model/builder/DataEntryFactory.java
// public static DataEntry createEmpty(String name, String prompt) {
//     return new StringDataEntry(name, "", prompt);
// }


import de.fesere.hypermedia.cj.exceptions.ElementNotFoundException;
import org.junit.Test;
import java.net.URI;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import static de.fesere.hypermedia.cj.model.builder.DataEntryFactory.createEmpty;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.core.Is.is;

    @Test
    public void testBuildURI_singleElementInQueryIsSetToInt() {

        Query theQuery = createBaseQueryWith3Entries();
        theQuery.set("foo", 12);

        URI uri = theQuery.buildURI();
        assertThat(uri.toString(), is(BASE_URI+"?foo=12"));
    }

    @Test
    public void testBuildURI_singleElementInQueryIsSetToBoolean() {

        Query theQuery = createBaseQueryWith3Entries();
        theQuery.set("foo", true);

        URI uri = theQuery.buildURI();
        assertThat(uri.toString(), is(BASE_URI+"?foo=true"));
    }

    @Test(expected = ElementNotFoundException.class)
    public void testBuildURI_settingNonExistingElementThrowsException() {

        Query theQuery = createBaseQueryWith3Entries();
        theQuery.set("doesNotExist", "a");
    }

    @Test
    public void testBuildUri_settingBooleanAndNumber_success() {
// Path: src/main/java/de/fesere/hypermedia/cj/exceptions/ElementNotFoundException.java
// public class ElementNotFoundException extends RuntimeException {
//     public ElementNotFoundException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/de/fesere/hypermedia/cj/model/builder/DataEntryFactory.java
// public static DataEntry createEmpty(String name, String prompt) {
//     return new StringDataEntry(name, "", prompt);
// }


// Path: src/test/java/de/fesere/hypermedia/cj/model/QueryTest.java
import de.fesere.hypermedia.cj.exceptions.ElementNotFoundException;
import org.junit.Test;
import java.net.URI;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
import static de.fesere.hypermedia.cj.model.builder.DataEntryFactory.createEmpty;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.core.Is.is;


    @Test
    public void testBuildURI_singleElementInQueryIsSetToInt() {

        Query theQuery = createBaseQueryWith3Entries();
        theQuery.set("foo", 12);

        URI uri = theQuery.buildURI();
        assertThat(uri.toString(), is(BASE_URI+"?foo=12"));
    }

    @Test
    public void testBuildURI_singleElementInQueryIsSetToBoolean() {

        Query theQuery = createBaseQueryWith3Entries();
        theQuery.set("foo", true);

        URI uri = theQuery.buildURI();
        assertThat(uri.toString(), is(BASE_URI+"?foo=true"));
    }

    @Test(expected = ElementNotFoundException.class)
    public void testBuildURI_settingNonExistingElementThrowsException() {

        Query theQuery = createBaseQueryWith3Entries();
        theQuery.set("doesNotExist", "a");
    }

    @Test
    public void testBuildUri_settingBooleanAndNumber_success() {
       Query theQury = new Query(BASE_URI, "foo", null, Arrays.asList(createEmpty("admin"), createEmpty("age")));