Back to project page watchme.
The source code is released under:
Copyright (c) 2012 Johan Brook, Robin Andersson, Lisa Stenberg, Mattias Henriksson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documen...
If you think the Android project watchme listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package se.chalmers.watchmetest.activity; /*from w w w . j a v a2s . c o m*/ import se.chalmers.watchme.activity.TagMovieListActivity; import se.chalmers.watchme.ui.MovieListFragment; import se.chalmers.watchme.ui.TagListFragment; import android.content.Intent; import android.support.v4.app.FragmentManager; import android.test.ActivityInstrumentationTestCase2; /** * Class that tests functionality implemented in the TagMovieListActivity class. * * @author mattiashenriksson * */ public class TagMovieListActivityTest extends ActivityInstrumentationTestCase2<TagMovieListActivity> { public TagMovieListActivityTest() { super(TagMovieListActivity.class); } @Override protected void setUp() throws Exception { super.setUp(); } /** * Test if code in onCreate() is working properly, i.e. * that the tag id that is sent into the activity with an intent is passed * on to the MovieListFragment that is created there. */ public void testOnCreate() { Long randomTagId = (long) (Math.random() * 10000); // Inject intent with a tag id into activity Intent intent = new Intent(); intent.putExtra(TagListFragment.TAG_ID, randomTagId); this.setActivityIntent(intent); TagMovieListActivity tmla = this.getActivity(); // Get fragment created in activity FragmentManager fragmentManager = tmla.getSupportFragmentManager(); MovieListFragment movieListFragment = (MovieListFragment) fragmentManager .findFragmentById(android.R.id.content); assertTrue(randomTagId == movieListFragment.getTagId()); } }