package com.andela.voluminotesapp.activities;

import android.support.test.espresso.assertion.ViewAssertions;
import android.support.test.rule.ActivityTestRule;

import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.junit.Assert.*;

/**
 * Created by andela on 2/13/16.
 */
public class MainActivityTest {

    @Rule
    public ActivityTestRule<MainActivity> activityTestRule = new ActivityTestRule<>(MainActivity.class);

    @Before
    public void setUp() throws Exception {

    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void testOnCreate() throws Exception {
        onView(withText("Hello")).check(ViewAssertions.matches(isDisplayed()));
    }
}
@@ -122,42 +122,82 @@
 oid.
-support.test.rule.ActivityTestRule
+test.ActivityInstrumentationTestCase2;%0A%0Aimport com.andela.voluminotesapp.R
 ;%0A%0Ai
@@ -216,22 +216,22 @@
 nit.
-After;
+Test;%0A
 %0Aimport 
 org.
@@ -230,73 +230,206 @@
 ort 
-org.junit.Before;%0Aimport org.junit.Rule;%0Aimport org.junit.Tes
+static android.support.test.espresso.Espresso.onView;%0Aimport static android.support.test.espresso.action.ViewActions.click;%0Aimport static android.support.test.espresso.action.ViewActions.swipeLef
 t;%0A
-%0A
 impo
@@ -472,100 +472,274 @@
 sso.
-Espresso.onView;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.isDisplaye
+action.ViewActions.typeText;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;%0Aimport static android.support.test.espresso.matcher.ViewMatchers.withI
 d;%0Ai
@@ -815,42 +815,8 @@
 ext;
-%0Aimport static org.junit.Assert.*;
 %0A%0A/*
@@ -888,138 +888,925 @@
 est 
-%7B%0A%0A    @Rule%0A    public ActivityTestRule%3CMainActivity%3E activityTestRule = new ActivityTestRule%3C%3E(MainActivity.class);%0A%0A    @Before
+extends ActivityInstrumentationTestCase2%7B%0A%0A    public MainActivityTest() %7B%0A        super(MainActivity.class);%0A    %7D%0A%0A    @Override%0A    public void setUp() throws Exception %7B%0A        super.setUp();%0A        getActivity();%0A    %7D%0A%0A    @Override%0A    public void tearDown() throws Exception %7B%0A        testOnDeleteAllNote();%0A    %7D%0A%0A    private void takeANote()%7B%0A        onView(withText(%22Take a note%22)).perform(click());%0A        onView(withId(R.id.noteTitle)).perform(typeText(%2201 This is a simple title%22));%0A        onView(withId(R.id.noteArea)).perform(typeText(%22This is a simple content and you're gonna love it. peace!%22));%0A        onView(withContentDescription(%22Navigate up%22)).perform(click());%0A    %7D%0A%0A    @Test%0A    public void testOnDeleteAllNote() %7B%0A        MyApplication.getNoteManager(getActivity()).deleteAll();%0A        onView(withId(R.id.toolbar_title)).check(ViewAssertions.matches(isDisplayed()));%0A    %7D%0A%0A    @Test
 %0A   
@@ -1810,37 +1810,48 @@
     public void 
-setUp
+testOnCreateNote
 () throws Except
@@ -1852,32 +1852,52 @@
 Exception %7B%0A
+        takeANote();
 %0A    %7D%0A%0A
     @After%0A 
@@ -1888,18 +1888,18 @@
  %7D%0A%0A
+%0A
     @
-After
+Test
 %0A   
@@ -1905,38 +1905,44 @@
   public void te
-arDown
+stOnReadNote
 () throws Except
@@ -1947,16 +1947,88 @@
 ption %7B%0A
+        takeANote();%0A        onView(withId(R.id.text)).perform(click());
 %0A    %7D%0A%0A
@@ -2059,20 +2059,22 @@
 d testOn
-Crea
+EditNo
 te() thr
@@ -2101,76 +2101,556 @@
     
-onView(withText(%22Hello%22)).check(ViewAssertions.matches(isDisplayed()
+takeANote();%0A        onView(withId(R.id.text)).perform(click());%0A        onView(withId(R.id.noteTitle)).perform(typeText(%2202 This is an expensive title%22));%0A        onView(withId(R.id.noteArea)).perform(typeText(%22This is an expensive content and you're gonna buy it. harmony!%22));%0A        onView(withContentDescription(%22Navigate up%22)).perform(click());%0A    %7D%0A%0A    @Test%0A    public void testOnDelete() throws Exception %7B%0A        takeANote();%0A        onView(withId(R.id.list_icon)).perform(click());%0A        onView(withId(R.id.text)).perform(swipeLeft(
 ));%0A

Write BDD test to pass voluminotes app logic