• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package com.xtremelabs.robolectric.shadows;
2 
3 import android.app.TabActivity;
4 import android.widget.TabHost;
5 import android.widget.TabWidget;
6 import com.xtremelabs.robolectric.R;
7 import com.xtremelabs.robolectric.WithTestDefaultsRunner;
8 import org.junit.Test;
9 import org.junit.runner.RunWith;
10 
11 import static org.hamcrest.CoreMatchers.instanceOf;
12 import static org.hamcrest.core.IsEqual.equalTo;
13 import static org.junit.Assert.assertThat;
14 
15 @RunWith(WithTestDefaultsRunner.class)
16 public class TabActivityTest {
17 
18     @Test
tabActivityShouldNotMakeNewTabHostEveryGet()19     public void tabActivityShouldNotMakeNewTabHostEveryGet() throws Exception {
20         TabActivity activity = new TabActivity();
21         TabHost tabHost1 = activity.getTabHost();
22         TabHost tabHost2 = activity.getTabHost();
23 
24         assertThat(tabHost1, equalTo(tabHost2));
25     }
26 
27     @Test
shouldGetTabWidget()28     public void shouldGetTabWidget() throws Exception {
29         TabActivity activity = new TabActivity();
30         activity.setContentView(R.layout.tab_activity);
31         assertThat(activity.getTabWidget(), instanceOf(TabWidget.class));
32     }
33 }
34