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