Android Open Source - filmster J S O N Parser Spec From Project Back to project page filmster .
License The source code is released under:
Apache License
If you think the Android project filmster listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.doodeec.filmster.Model;
/ * f r o m w w w . j a v a 2 s . c o m * /
import android.test.InstrumentationTestCase;
import com.doodeec.filmster.Mock;
import org.json.JSONObject;
/**
* Created by Dusan Doodeec Bartos on 20.10.2014.
*
* @see com.doodeec.filmster.Model.JSONParser
*/
public class JSONParserSpec extends InstrumentationTestCase {
private JSONObject mJson;
@Override
protected void setUp() throws Exception {
super.setUp();
mJson = Mock.REST_MOVIE();
assertNotNull(mJson);
}
public void testGetInt() throws Exception {
assertNotNull(JSONParser.getIntForKey(mJson, "year" ));
assertEquals(mJson.get("year" ), JSONParser.getIntForKey(mJson, "year" ));
}
public void testGetString() throws Exception {
assertNotNull(JSONParser.getStringForKey(mJson, "id" ));
assertEquals(mJson.get("id" ), JSONParser.getStringForKey(mJson, "id" ));
}
public void testGetObject() throws Exception {
assertNotNull(JSONParser.getObjectForKey(mJson, "ratings" ));
// assertEquals(mJson.get("ratings"), JSONParser.getObjectForKey(mJson, "ratings"));
}
public void testGetArray() throws Exception {
assertNotNull(JSONParser.getArrayForKey(mJson, "abridged_cast" ));
assertEquals(5, JSONParser.getArrayForKey(mJson, "abridged_cast" ).length());
}
}
Java Source Code List com.doodeec.filmster.HelperSpec.java com.doodeec.filmster.Helper.java com.doodeec.filmster.ImageCacheSpec.java com.doodeec.filmster.ImageCache.java com.doodeec.filmster.MainActivity.java com.doodeec.filmster.Mock.java com.doodeec.filmster.ApplicationState.AppStateSpec.java com.doodeec.filmster.ApplicationState.AppState.java com.doodeec.filmster.ApplicationState.ConnectionStateChange.java com.doodeec.filmster.Model.JSONParserSpec.java com.doodeec.filmster.Model.JSONParser.java com.doodeec.filmster.Model.MovieDefinitionKeys.java com.doodeec.filmster.Model.MovieSpec.java com.doodeec.filmster.Model.Movie.java com.doodeec.filmster.MovieDetail.MovieDetailFragmentSpec.java com.doodeec.filmster.MovieDetail.MovieDetailFragment.java com.doodeec.filmster.MovieList.MovieListActivityInterface.java com.doodeec.filmster.MovieList.MovieListAdapterSpec.java com.doodeec.filmster.MovieList.MovieListAdapter.java com.doodeec.filmster.MovieList.MovieListFragmentSpec.java com.doodeec.filmster.MovieList.MovieListFragment.java com.doodeec.filmster.MovieList.MovieListItemHolderSpec.java com.doodeec.filmster.MovieList.MovieListItemHolder.java com.doodeec.filmster.Provider.DbHelperSpec.java com.doodeec.filmster.Provider.DbHelper.java com.doodeec.filmster.Provider.MovieEntry.java com.doodeec.filmster.Provider.MovieProviderSpec.java com.doodeec.filmster.Provider.MovieProvider.java com.doodeec.filmster.ServerCommunicator.ResourceServiceSpec.java com.doodeec.filmster.ServerCommunicator.ResourceService.java com.doodeec.filmster.ServerCommunicator.ResponseListener.BitmapServerResponseListener.java com.doodeec.filmster.ServerCommunicator.ResponseListener.JSONServerResponseListener.java com.doodeec.filmster.ServerCommunicator.ResponseListener.ServerResponseListener.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ErrorResponseSpec.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ErrorResponse.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ServerRequestInterface.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ServerRequestSpec.java com.doodeec.filmster.ServerCommunicator.ServerRequest.ServerRequest.java