package com.github.dddpaul.netcat;

import android.widget.AutoCompleteTextView;
import android.widget.Button;

import com.github.dddpaul.netcat.ui.MainFragment;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import static org.robolectric.util.FragmentTestUtil.startFragment;

@Config( emulateSdk = 18 )
@RunWith( RobolectricTestRunner.class )
public class MainFragmentTest extends Assert
{
    private MainFragment fragment;

    @Before
    public void setUp()
    {
        fragment = new MainFragment();
    }

    /**
     * Test connect button behaviour
     */
    @Test
    public void testConnectToButton()
    {
        startFragment( fragment );
        Button connectButton = (Button) fragment.getView().findViewById( R.id.b_connect );

        assertNotNull( connectButton );
        assertFalse( connectButton.isEnabled() );

        AutoCompleteTextView connectToText = (AutoCompleteTextView) fragment.getView().findViewById( R.id.et_connect_to );
        connectToText.setText( "some host" );

        assertTrue( connectButton.isEnabled() );
    }
}

@@ -159,33 +159,8 @@
 t;%0A%0A
-import org.junit.Assert;%0A
 impo
@@ -180,16 +180,16 @@
 Before;%0A
+
 import o
@@ -325,16 +325,74 @@
 onfig;%0A%0A
+import static org.fest.assertions.api.ANDROID.assertThat;%0A
 import s
@@ -551,23 +551,8 @@
 Test
- extends Assert
 %0A%7B%0A 
@@ -926,15 +926,12 @@
 sert
-NotNull
+That
 ( co
@@ -947,58 +947,21 @@
 on )
-;%0A        assertFalse( connectButton.isEn
+.isDis
 abled()
- )
 ;%0A%0A 
@@ -1148,11 +1148,11 @@
 ertT
-rue
+hat
 ( co
@@ -1162,16 +1162,18 @@
 ctButton
+ )
 .isEnabl
@@ -1176,18 +1176,16 @@
 nabled()
- )
 ;%0A    %7D%0A

Use android-fest assertions