Skip to content

Commit c16b4de

Browse files
committed
removing tasks before starting test
1 parent e6d7037 commit c16b4de

File tree

2 files changed

+6
-1
lines changed
  • todoapp/app/src

2 files changed

+6
-1
lines changed

todoapp/app/src/androidTest/java/com/example/android/architecture/blueprints/todoapp/tasks/TasksScreenTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,19 @@
1616

1717
package com.example.android.architecture.blueprints.todoapp.tasks;
1818

19+
import android.support.test.InstrumentationRegistry;
1920
import android.support.test.rule.ActivityTestRule;
2021
import android.support.test.runner.AndroidJUnit4;
2122
import android.test.suitebuilder.annotation.LargeTest;
2223
import android.text.TextUtils;
2324
import android.view.View;
2425
import android.widget.ListView;
2526

27+
import com.example.android.architecture.blueprints.todoapp.Injection;
2628
import com.example.android.architecture.blueprints.todoapp.R;
2729
import com.example.android.architecture.blueprints.todoapp.TestUtils;
2830
import com.example.android.architecture.blueprints.todoapp.data.source.TasksDataSource;
31+
import com.example.android.architecture.blueprints.todoapp.data.source.local.TasksLocalDataSource;
2932

3033
import org.hamcrest.Description;
3134
import org.hamcrest.Matcher;
@@ -75,7 +78,8 @@ public class TasksScreenTest {
7578
@Override
7679
protected void beforeActivityLaunched() {
7780
super.beforeActivityLaunched();
78-
81+
TasksLocalDataSource tasksLocalDataSource = Injection.provideLocalDataSource(InstrumentationRegistry.getTargetContext());
82+
tasksLocalDataSource.deleteAllTasks();
7983
}
8084
};
8185

todoapp/app/src/mock/java/com/example/android/architecture/blueprints/todoapp/Injection.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
public class Injection {
3838

3939
public static TasksOperations provideTasksOperations(LoaderProvider mLoaderProvider, LoaderManager mLoaderManager, ContentResolver mContentResolver) {
40+
4041
return TasksOperations.getInstance(mLoaderProvider, mLoaderManager, mContentResolver);
4142
}
4243

0 commit comments

Comments
 (0)