/**
 *	MovieHelperTest.java
 *
 *	@author Johan Brook
 *	@copyright (c) 2012 Johan Brook
 *	@license MIT
 */

package se.chalmers.watchmetest.util;

import java.util.LinkedList;
import java.util.List;

import junit.framework.TestCase;
import se.chalmers.watchme.model.Tag;
import se.chalmers.watchme.utils.MovieHelper;
import android.test.suitebuilder.annotation.SmallTest;


public class MovieHelperTest extends TestCase {
	
	public MovieHelperTest() {
		super();
	}
	
	public void setUp() throws Exception {
		super.setUp();
	}
	
	public void testStringArrayToTagList() {
		
		String[] tagStrings = {"tag1", "tag2", "tag3", "tag4", "tag5"};
		
		List<Tag> tags = MovieHelper.stringArrayToTagList(tagStrings);
		
		for(String tagString : tagStrings) {
			assertTrue(tags.contains(new Tag(tagString)));
		}
		
	}
	
}

@@ -163,14 +163,8 @@
 til.
-Linked
 List
@@ -172,30 +172,65 @@
 %0Aimport 
-java.util.List
+org.json.JSONArray;%0Aimport org.json.JSONException
 ;%0A%0Aimpor
@@ -290,19 +290,21 @@
 e.model.
-Tag
+Movie
 ;%0Aimport
@@ -328,237 +328,114 @@
 hme.
-utils.MovieHelper;%0Aimport android.test.suitebuilder.annotation.SmallTest;%0A%0A%0Apublic class MovieHelperTest extends TestCase %7B%0A%09%0A%09public MovieHelperTest() %7B%0A%09%09super();%0A%09%7D%0A%09%0A%09public void setUp() throws Exception %7B%0A%09%09super.setUp();%0A%09%7D
+model.Tag;%0Aimport se.chalmers.watchme.utils.MovieHelper;%0A%0A%0Apublic class MovieHelperTest extends TestCase %7B
 %0A%09%0A%09
@@ -716,10 +716,614 @@
 %09%09%0A%09%7D%0A%09%0A
+%09public void testJsonArrayToMovieList() %7B%0A%09%09String json = %22%5B%7B%5C%22%22+ Movie.JSON_KEY_NAME +%22%5C%22: %5C%22James Bond%5C%22, %22+ %0A%09%09%09%09%09%09%22%5C%22%22+ Movie.JSON_KEY_ID + %22%5C%22: 202929%7D%5D%22;%0A%09%09%0A%09%09try %7B%0A%09%09%09JSONArray array = new JSONArray(json);%0A%09%09%09%0A%09%09%09assertNotNull(array);%0A%09%09%09assertTrue(array.length() == 1);%0A%09%09%09%0A%09%09%09List%3CMovie%3E movies = MovieHelper.jsonArrayToMovieList(array);%0A%09%09%09%0A%09%09%09assertEquals(array.length(), movies.size());%0A%09%09%09%0A%09%09%09Movie movie = movies.get(0);%0A%09%09%09%0A%09%09%09assertEquals(%22James Bond%22, movie.getTitle());%0A%09%09%09assertEquals(202929, movie.getApiID());%0A%09%09%09%0A%09%09%7D catch (JSONException e) %7B%0A%09%09%09e.printStackTrace();%0A%09%09%7D%0A%09%09%0A%09%09%0A%09%7D%0A%09%0A
 %7D%0A

Add tests for JsonArrayToMovieList