package com.tarcle.moment.activity;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.util.ActivityController;

import static org.assertj.core.api.Assertions.assertThat;

@RunWith(RobolectricTestRunner.class)
@Config(manifest = "src/main/AndroidManifest.xml", emulateSdk = 18)
public class RootActivityTest {

    private ActivityController<RootActivity> controller;

    @Before
    public void setUp() {
        controller = Robolectric.buildActivity(RootActivity.class).create();
    }

    @Test
    public void shouldCreateRootActivity() {
        assertThat(controller.get()).isNotNull();
    }
    
    @Test
    public void shouldShowCircleFragment() {
        
    }
    
    @Test
    public void shouldShowTopicFragment() {
        
        
    }
    
    @Test
    public void shouldShowMineFragment(){
        
        
    }
    
}
@@ -30,16 +30,258 @@
 ivity;%0A%0A
+import android.app.Activity;%0Aimport android.app.FragmentTransaction;%0Aimport android.content.Context;%0Aimport android.view.View;%0Aimport android.widget.FrameLayout;%0A%0Aimport com.tarcle.moment.R;%0Aimport com.tarcle.moment.fragment.CircleFragment;%0A%0A
 import o
@@ -477,16 +477,63 @@
 Config;%0A
+import org.robolectric.shadows.ShadowActivity;%0A
 import o
@@ -573,16 +573,49 @@
 oller;%0A%0A
+import butterknife.ButterKnife;%0A%0A
 import s
@@ -663,16 +663,228 @@
 ertThat;
+%0Aimport static org.mockito.Matchers.any;%0Aimport static org.mockito.Matchers.eq;%0Aimport static org.mockito.Mockito.spy;%0Aimport static org.mockito.Mockito.verify;%0Aimport static org.robolectric.Robolectric.shadowOf;
 %0A%0A@RunWi
@@ -1028,24 +1028,28 @@
 private 
+Root
 Activity
 Controll
@@ -1044,43 +1044,17 @@
 vity
-Controller%3CRootActivity%3E controller
+ activity
 ;%0A%0A 
@@ -1098,26 +1098,24 @@
         
-controller
+activity
  = Robol
@@ -1163,16 +1163,39 @@
 create()
+.start().resume().get()
 ;%0A    %7D%0A
@@ -1273,24 +1273,16 @@
 hat(
-controller.get()
+activity
 ).is
@@ -1335,20 +1335,31 @@
 d should
-Show
+UpdtaeTitleWhen
 CircleFr
@@ -1356,32 +1356,37 @@
 enCircleFragment
+Shows
 () %7B%0A        %0A  
@@ -1374,32 +1374,163 @@
 ows() %7B%0A        
+activity.onNavigationDrawerItemSelected(0);%0A        assertThat(activity.getTitle()).isEqualTo(activity.getString(R.string.circle));
 %0A    %7D%0A    %0A    
@@ -1557,20 +1557,31 @@
 d should
-Show
+UpdateTitleWhen
 TopicFra
@@ -1585,16 +1585,21 @@
 Fragment
+Shows
 () %7B%0A   
@@ -1599,33 +1599,154 @@
 ) %7B%0A        
-%0A        
+activity.onNavigationDrawerItemSelected(1);%0A        assertThat(activity.getTitle()).isEqualTo(activity.getString(R.string.topic));
 %0A    %7D%0A    %0A
@@ -1777,20 +1777,31 @@
 d should
-Show
+UpdateTitleWhen
 MineFrag
@@ -1804,16 +1804,21 @@
 Fragment
+Shows
 ()%7B%0A    
@@ -1821,25 +1821,145 @@
         
-%0A        
+activity.onNavigationDrawerItemSelected(2);%0A        assertThat(activity.getTitle()).isEqualTo(activity.getString(R.string.mine));
 %0A    %7D%0A 

Add RootActivity unit test