From 697951a7e4eb5397f34c24455bb17e72cabd42e0 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Mon, 29 Apr 2019 12:11:23 -0500 Subject: [PATCH] Fix subtasks moving tests --- .../astrid/subtasks/SubtasksHelperTest.java | 2 -- .../astrid/subtasks/SubtasksMovingTest.java | 16 ++++++++-------- .../astrid/subtasks/SubtasksTestCase.java | 8 +------- .../java/org/tasks/injection/TestComponent.java | 4 ++-- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksHelperTest.java b/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksHelperTest.java index fd65e5613..f893f3dea 100644 --- a/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksHelperTest.java +++ b/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksHelperTest.java @@ -66,8 +66,6 @@ public class SubtasksHelperTest extends SubtasksTestCase { @Override protected void inject(TestComponent component) { - super.inject(component); - component.inject(this); } } diff --git a/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksMovingTest.java b/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksMovingTest.java index ebdfb241b..06ccdaccb 100644 --- a/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksMovingTest.java +++ b/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksMovingTest.java @@ -4,10 +4,10 @@ import androidx.test.runner.AndroidJUnit4; import com.todoroo.astrid.dao.TaskDao; import com.todoroo.astrid.data.Task; import javax.inject.Inject; -import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.tasks.data.TaskListMetadata; +import org.tasks.injection.TestComponent; @RunWith(AndroidJUnit4.class) public class SubtasksMovingTest extends SubtasksTestCase { @@ -16,8 +16,8 @@ public class SubtasksMovingTest extends SubtasksTestCase { private Task A, B, C, D, E, F; - // @Override - protected void disabled_setUp() { + @Override + public void setUp() { super.setUp(); createTasks(); TaskListMetadata m = new TaskListMetadata(); @@ -34,6 +34,11 @@ public class SubtasksMovingTest extends SubtasksTestCase { expectParentAndPosition(F, null, 2); } + @Override + protected void inject(TestComponent component) { + component.inject(this); + } + private void createTasks() { A = createTask("A"); B = createTask("B"); @@ -65,7 +70,6 @@ public class SubtasksMovingTest extends SubtasksTestCase { * F */ - @Ignore @Test public void testMoveBeforeIntoSelf() { // Should have no effect whenTriggerMoveBefore(A, B); @@ -78,7 +82,6 @@ public class SubtasksMovingTest extends SubtasksTestCase { expectParentAndPosition(F, null, 2); } - @Ignore @Test public void testMoveIntoDescendant() { // Should have no effect whenTriggerMoveBefore(A, C); @@ -91,7 +94,6 @@ public class SubtasksMovingTest extends SubtasksTestCase { expectParentAndPosition(F, null, 2); } - @Ignore @Test public void testMoveToEndOfChildren() { // Should have no effect whenTriggerMoveBefore(A, E); @@ -104,7 +106,6 @@ public class SubtasksMovingTest extends SubtasksTestCase { expectParentAndPosition(F, null, 2); } - @Ignore @Test public void testStandardMove() { whenTriggerMoveBefore(A, F); @@ -117,7 +118,6 @@ public class SubtasksMovingTest extends SubtasksTestCase { expectParentAndPosition(F, null, 2); } - @Ignore @Test public void testMoveToEndOfList() { whenTriggerMoveBefore(A, null); diff --git a/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksTestCase.java b/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksTestCase.java index f503aac9c..e591955d6 100644 --- a/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksTestCase.java +++ b/app/src/androidTest/java/com/todoroo/astrid/subtasks/SubtasksTestCase.java @@ -12,7 +12,6 @@ import com.todoroo.astrid.subtasks.SubtasksFilterUpdater.Node; import javax.inject.Inject; import org.tasks.data.TaskListMetadataDao; import org.tasks.injection.InjectingTestCase; -import org.tasks.injection.TestComponent; import org.tasks.preferences.Preferences; /** @@ -20,7 +19,7 @@ import org.tasks.preferences.Preferences; * * @author Sam */ -public class SubtasksTestCase extends InjectingTestCase { +public abstract class SubtasksTestCase extends InjectingTestCase { /* Starting State: * @@ -46,11 +45,6 @@ public class SubtasksTestCase extends InjectingTestCase { updater = new SubtasksFilterUpdater(taskListMetadataDao, taskDao); } - @Override - protected void inject(TestComponent component) { - component.inject(this); - } - void expectParentAndPosition(Task task, Task parent, int positionInParent) { String parentId = (parent == null ? "-1" : parent.getUuid()); Node n = updater.findNodeForTask(task.getUuid()); diff --git a/app/src/androidTest/java/org/tasks/injection/TestComponent.java b/app/src/androidTest/java/org/tasks/injection/TestComponent.java index f1594a451..dc46cdc2f 100644 --- a/app/src/androidTest/java/org/tasks/injection/TestComponent.java +++ b/app/src/androidTest/java/org/tasks/injection/TestComponent.java @@ -13,7 +13,7 @@ import com.todoroo.astrid.repeats.RepeatTaskHelperTest; import com.todoroo.astrid.service.QuickAddMarkupTest; import com.todoroo.astrid.service.TitleParserTest; import com.todoroo.astrid.subtasks.SubtasksHelperTest; -import com.todoroo.astrid.subtasks.SubtasksTestCase; +import com.todoroo.astrid.subtasks.SubtasksMovingTest; import com.todoroo.astrid.sync.NewSyncTestCase; import dagger.Component; import org.tasks.data.DeletionDaoTests; @@ -39,7 +39,7 @@ public interface TestComponent extends ApplicationComponent { void inject(NewSyncTestCase newSyncTestCase); - void inject(SubtasksTestCase subtasksTestCase); + void inject(SubtasksMovingTest subtasksTestCase); void inject(SubtasksHelperTest subtasksHelperTest);