package com.constructor.client;

import static org.junit.Assert.assertEquals;
import java.util.*;

import org.junit.Test;

public class ConstructorTest {

	/**
	 * The official fake account apiToken is YSOxV00F0Kk2R0KnPQN8
	 * The official fake account acKey is ZqXaOfXuBWD4s3XzCI1q
	 */

	@Test
	public void encodesParamsShouldEncodeParams() throws Exception {
		ConstructorIO constructor = new ConstructorIO("boinka", "doinka", true, null);
		HashMap<String, String> params = new HashMap<String, String>();
		params.put("foo", "bar");
		params.put("bar", "baz");
		String serializedParams = constructor.serializeParams(params);
		assertEquals("serializes params correctly", serializedParams, "foo=bar&bar=baz");
	}
	
	@Test
	public void urlsShouldBeCreated() throws Exception{
		ConstructorIO constructor = new ConstructorIO("boinka", "doinka", true, null);
		String generatedUrl = constructor.makeUrl("v1/test");
		assertEquals("creates url correctly", generatedUrl, "https://ac.cnstrc.com/v1/test?autocomplete_key=doinka");
	}
	
	@Test
	public void apiTokenShouldBeSet() throws Exception {
		ConstructorIO constructor = new ConstructorIO("boinka", "doinka", true, null);
		assertEquals("api token should be set properly", constructor.apiToken, "boinka");
	}
	
	@Test
	public void acKeyShouldBeSet() throws Exception {
		ConstructorIO constructor = new ConstructorIO("boinka", "doinka", true, null);
		assertEquals("ac key should be set properly", constructor.autocompleteKey, "doinka");
	}
	
	@Test
	public void acQueryShouldReturn() throws Exception {
		ConstructorIO constructor = new ConstructorIO("YSOxV00F0Kk2R0KnPQN8", "ZqXaOfXuBWD4s3XzCI1q", true, null);
		JsonNode res = constructor.query("S");
		assertEquals("ac query should return something", 1, 1);
	}
	
	@Test
	public void addShouldReturnNoParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void addShouldReturnParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void removeShouldReturnNoParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void removeShouldReturnParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void modifyShouldReturnNoParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void modifyShouldReturnParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void conversionShouldReturnNoParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void conversionShouldReturnParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void searchShouldReturnNoParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void searchShouldReturnParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void clickThroughShouldReturnNoParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}
	
	@Test
	public void clickThroughShouldReturnParams() throws Exception {
		assertEquals("not implemented yet", 1, 1);
	}

} 

@@ -114,16 +114,112 @@
 it.Test;
+%0Aimport com.mashape.unirest.http.*;%0Aimport com.mashape.unirest.http.exceptions.UnirestException;
 %0A%0Apublic
@@ -1847,20 +1847,54 @@
 thing%22, 
-1, 1
+res.toString(), %22%7B%5C%22suggestions%5C%22:%5B%5D%7D%22
 );%0A%09%7D%0A%09%0A
@@ -1908,32 +1908,40 @@
 %09public void add
+NoParams
 ShouldReturnNoPa
@@ -1932,32 +1932,24 @@
 ShouldReturn
-NoParams
 () throws Ex
@@ -2031,16 +2031,26 @@
 void add
+WithParams
 ShouldRe
@@ -2045,38 +2045,32 @@
 ramsShouldReturn
-Params
 () throws Except
@@ -2143,32 +2143,40 @@
 blic void remove
+NoParams
 ShouldReturnNoPa
@@ -2167,32 +2167,24 @@
 ShouldReturn
-NoParams
 () throws Ex
@@ -2269,16 +2269,26 @@
 d remove
+WithParams
 ShouldRe
@@ -2283,38 +2283,32 @@
 ramsShouldReturn
-Params
 () throws Except
@@ -2381,32 +2381,40 @@
 blic void modify
+NoParams
 ShouldReturnNoPa
@@ -2405,32 +2405,24 @@
 ShouldReturn
-NoParams
 () throws Ex
@@ -2507,16 +2507,26 @@
 d modify
+WithParams
 ShouldRe
@@ -2521,38 +2521,32 @@
 ramsShouldReturn
-Params
 () throws Except
@@ -2623,32 +2623,40 @@
  void conversion
+NoParams
 ShouldReturnNoPa
@@ -2647,32 +2647,24 @@
 ShouldReturn
-NoParams
 () throws Ex
@@ -2753,16 +2753,26 @@
 nversion
+WithParams
 ShouldRe
@@ -2767,38 +2767,32 @@
 ramsShouldReturn
-Params
 () throws Except
@@ -2865,32 +2865,40 @@
 blic void search
+NoParams
 ShouldReturnNoPa
@@ -2889,32 +2889,24 @@
 ShouldReturn
-NoParams
 () throws Ex
@@ -2991,16 +2991,26 @@
 d search
+WithParams
 ShouldRe
@@ -3005,38 +3005,32 @@
 ramsShouldReturn
-Params
 () throws Except
@@ -3109,32 +3109,40 @@
 oid clickThrough
+NoParams
 ShouldReturnNoPa
@@ -3137,24 +3137,16 @@
 ldReturn
-NoParams
 () throw
@@ -3241,16 +3241,26 @@
 kThrough
+WithParams
 ShouldRe
@@ -3263,22 +3263,16 @@
 ldReturn
-Params
 () throw

add query test proper