• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.xtremelabs.robolectric.shadows;
2 
3 import android.os.Bundle;
4 import com.google.android.maps.MapActivity;
5 import com.xtremelabs.robolectric.WithTestDefaultsRunner;
6 import org.junit.Test;
7 import org.junit.runner.RunWith;
8 
9 @RunWith(WithTestDefaultsRunner.class)
10 public class MapActivityTest {
11     @Test
onDestroy_shouldNotComplainIfLifecycleIsCorrect()12     public void onDestroy_shouldNotComplainIfLifecycleIsCorrect() throws Exception {
13         MyMapActivity mapActivity = new MyMapActivity();
14         mapActivity.onCreate(null);
15         mapActivity.onResume();
16         mapActivity.onPause();
17         mapActivity.onDestroy();
18     }
19 
20     @Test(expected = IllegalStateException.class)
onDestroy_shouldComplainIfPauseIsNotCalled()21     public void onDestroy_shouldComplainIfPauseIsNotCalled() throws Exception {
22         MyMapActivity mapActivity = new MyMapActivity();
23         mapActivity.onCreate(null);
24         mapActivity.onResume();
25         mapActivity.onDestroy();
26     }
27 
28     private static class MyMapActivity extends MapActivity {
onCreate(Bundle bundle)29         @Override protected void onCreate(Bundle bundle) {
30             super.onCreate(bundle);
31         }
32 
onDestroy()33         @Override protected void onDestroy() {
34             super.onDestroy();
35         }
36 
onPause()37         @Override protected void onPause() {
38             super.onPause();
39         }
40 
onResume()41         @Override protected void onResume() {
42             super.onResume();
43         }
44 
isRouteDisplayed()45         @Override protected boolean isRouteDisplayed() {
46             return false;
47         }
48     }
49 }
50