Advertisement
Guest User

LVTest

a guest
May 1st, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. package gs.livermore.cibapplication.spotify;
  2.  
  3. import android.app.Activity;
  4. import android.test.ActivityInstrumentationTestCase2;
  5. import android.util.Log;
  6. import android.widget.ListView;
  7. import android.widget.TextView;
  8.  
  9. import gs.livermore.cibapplication.R;
  10.  
  11. /**
  12. * Created by C1542294 on 28/04/2016.
  13. */
  14. public class SpotifyTest extends ActivityInstrumentationTestCase2<Spotify> {
  15.  
  16. Spotify s;
  17.  
  18. public SpotifyTest() {
  19. super(Spotify.class);
  20. }
  21.  
  22. public SpotifyTest(String pkg, Class<Spotify> activityClass) {
  23. super(pkg, activityClass);
  24. }
  25.  
  26. public SpotifyTest(Class<Spotify> activityClass) {
  27. super(activityClass);
  28. }
  29.  
  30. @Override
  31. public void setUp() throws Exception {
  32. super.setUp();
  33. s = getActivity();
  34.  
  35. }
  36.  
  37. public void testGameDescripUpdates() {
  38. Activity a = getActivity();
  39. final ListView listView1 = (ListView) a.findViewById(R.id.songListView);
  40. a.runOnUiThread(new Runnable() {
  41. @Override
  42. public void run() {
  43. listView1.requestFocus();
  44. listView1.performItemClick(
  45. listView1.getAdapter().getView(1, null, null),
  46. 1,
  47. listView1.getAdapter().getItemId(1));
  48. }
  49. });
  50. try {
  51. Thread.sleep(1000);
  52. } catch (InterruptedException e) {
  53. e.printStackTrace();
  54. }
  55.  
  56.  
  57. TextView songName = (TextView) a.findViewById(R.id.songTextView);
  58. Log.i(getActivity().getString(R.string.app_name), Spotify.trackDataSource.getAllTracks().get(1).getSong());
  59. assertEquals(songName.getText().toString(), Spotify.trackDataSource.getAllTracks().get(1).getSong());
  60. }
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement