package uk.co.placona.tradesafe.view;

import android.widget.EditText;
import android.widget.VideoView;

import org.assertj.android.api.preference.EditTextPreferenceAssert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.Robolectric;
import org.robolectric.RobolectricGradleTestRunner;
import org.robolectric.annotation.Config;

import uk.co.placona.tradesafe.BuildConfig;
import uk.co.placona.tradesafe.R;
import uk.co.placona.tradesafe.databinding.ActivityCreateBinding;

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

//
@RunWith(RobolectricGradleTestRunner.class)
@Config(constants = BuildConfig.class, sdk = 21)
public class CreateActivityTest {
    private CreateActivity activity;
    private ActivityCreateBinding binding;
    private EditText reference_txt;
    private EditText description_text;
    private VideoView video_view;

    @Before
    public void setupActivity(){
        activity = Robolectric.setupActivity(CreateActivity.class);
        reference_txt = (EditText) activity.findViewById(R.id.reference_txt);
        description_text = (EditText) activity.findViewById(R.id.description_txt);
        video_view = (VideoView) activity.findViewById(R.id.video_view);
    }

    @Test
    public void ActivityShouldNotBeNull() throws Exception {
        assertThat(activity).isNotNull();
    }

    @Test
    public void shouldHaveVisibleReference() throws Exception {
        assertThat(reference_txt).isNotNull();
        assertThat(reference_txt).isVisible();
    }

    @Test
    public void shouldHaveVisibleDescription() throws Exception {
        assertThat(description_text).isNotNull();
        assertThat(description_text).isVisible();
    }

    @Test
    public void shouldHaveVisibleVideo() throws Exception {
        assertThat(video_view).isNotNull();
        assertThat(video_view).isVisible();
    }

//    @Test
//    public void shouldHaveVisibleListView() throws Exception {
//        assertThat(rvTrades).isNotNull();
//        assertThat(rvTrades).isVisible();
//    }
//
//    @Test
//    public void shouldDisplayListViewWhenUserCancels() throws Exception {
//        fab.performClick();
//
//        ShadowActivity.IntentForResult intentForResult = Shadows.shadowOf(activity).peekNextStartedActivityForResult();
//        assertNotNull(intentForResult);
//
//        Shadows.shadowOf(activity).receiveResult(
//                new Intent(MediaStore.ACTION_VIDEO_CAPTURE),
//                Activity.RESULT_OK,
//                null);
//
//
//    }
//
//    @Test
//    public void clickingAddVideoShouldStartCameraActivity() {
//        fab.performClick();
//
//        Intent startedIntent = Shadows.shadowOf(activity).getNextStartedActivity();
//        Intent expectedIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);
//        assertThat(startedIntent).isEqualTo(expectedIntent);
//    }
//
//    @Test
//    public void buttonClickShouldStartNewActivity() throws Exception
//    {
//        fab.performClick();
//
//        ShadowActivity shadowActivity = Shadows.shadowOf(activity);
//        Intent startedIntent = shadowActivity.getNextStartedActivity();
//        ShadowIntent shadowIntent = Shadows.shadowOf(startedIntent);
//        assertEquals(shadowIntent.getIntentClass().getCanonicalName(),CreateActivity.class.getName());
//
//    }
}
@@ -102,76 +102,8 @@
 w;%0A%0A
-import org.assertj.android.api.preference.EditTextPreferenceAssert;%0A
 impo
@@ -123,16 +123,16 @@
 Before;%0A
+
 import o
@@ -517,19 +517,16 @@
 tThat;%0A%0A
-//%0A
 @RunWith
@@ -685,51 +685,8 @@
 ty;%0A
-    private ActivityCreateBinding binding;%0A
     
@@ -1790,1469 +1790,6 @@
    %7D
-%0A%0A//    @Test%0A//    public void shouldHaveVisibleListView() throws Exception %7B%0A//        assertThat(rvTrades).isNotNull();%0A//        assertThat(rvTrades).isVisible();%0A//    %7D%0A//%0A//    @Test%0A//    public void shouldDisplayListViewWhenUserCancels() throws Exception %7B%0A//        fab.performClick();%0A//%0A//        ShadowActivity.IntentForResult intentForResult = Shadows.shadowOf(activity).peekNextStartedActivityForResult();%0A//        assertNotNull(intentForResult);%0A//%0A//        Shadows.shadowOf(activity).receiveResult(%0A//                new Intent(MediaStore.ACTION_VIDEO_CAPTURE),%0A//                Activity.RESULT_OK,%0A//                null);%0A//%0A//%0A//    %7D%0A//%0A//    @Test%0A//    public void clickingAddVideoShouldStartCameraActivity() %7B%0A//        fab.performClick();%0A//%0A//        Intent startedIntent = Shadows.shadowOf(activity).getNextStartedActivity();%0A//        Intent expectedIntent = new Intent(MediaStore.ACTION_VIDEO_CAPTURE);%0A//        assertThat(startedIntent).isEqualTo(expectedIntent);%0A//    %7D%0A//%0A//    @Test%0A//    public void buttonClickShouldStartNewActivity() throws Exception%0A//    %7B%0A//        fab.performClick();%0A//%0A//        ShadowActivity shadowActivity = Shadows.shadowOf(activity);%0A//        Intent startedIntent = shadowActivity.getNextStartedActivity();%0A//        ShadowIntent shadowIntent = Shadows.shadowOf(startedIntent);%0A//        assertEquals(shadowIntent.getIntentClass().getCanonicalName(),CreateActivity.class.getName());%0A//%0A//    %7D
 %0A%7D

Clean up unit tests