mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 17:48:52 -06:00
Remove use of static context from HabitsApplication class (#224)
Remove static context from application class. Replace static method to obtain context with appropriate dependency. Remove context from controller. Add auto factory to export db task.
This commit is contained in:
@@ -225,7 +225,7 @@ public class BaseViewTest extends BaseAndroidTest
|
|||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
File dir = FileUtils.getSDCardDir("test-screenshots");
|
File dir = FileUtils.getSDCardDir("test-screenshots");
|
||||||
if (dir == null) dir = FileUtils.getFilesDir("test-screenshots");
|
if (dir == null) dir = FileUtils.getFilesDir(testContext,"test-screenshots");
|
||||||
if (dir == null) throw new RuntimeException(
|
if (dir == null) throw new RuntimeException(
|
||||||
"Could not find suitable dir for screenshots");
|
"Could not find suitable dir for screenshots");
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class ImportTest extends BaseAndroidTest
|
|||||||
|
|
||||||
fixtures.purgeHabits(habitList);
|
fixtures.purgeHabits(habitList);
|
||||||
context = InstrumentationRegistry.getInstrumentation().getContext();
|
context = InstrumentationRegistry.getInstrumentation().getContext();
|
||||||
baseDir = FileUtils.getFilesDir("Backups");
|
baseDir = FileUtils.getFilesDir(context, "Backups");
|
||||||
if (baseDir == null) fail("baseDir should not be null");
|
if (baseDir == null) fail("baseDir should not be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class ExportCSVTaskTest extends BaseAndroidTest
|
|||||||
for (Habit h : habitList) selected.add(h);
|
for (Habit h : habitList) selected.add(h);
|
||||||
|
|
||||||
taskRunner.execute(
|
taskRunner.execute(
|
||||||
new ExportCSVTask(habitList, selected, archiveFilename -> {
|
new ExportCSVTask(testContext,habitList, selected, archiveFilename -> {
|
||||||
assertThat(archiveFilename, is(not(nullValue())));
|
assertThat(archiveFilename, is(not(nullValue())));
|
||||||
File f = new File(archiveFilename);
|
File f = new File(archiveFilename);
|
||||||
assertTrue(f.exists());
|
assertTrue(f.exists());
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ExportDBTaskTest extends BaseAndroidTest
|
|||||||
@Test
|
@Test
|
||||||
public void testExportCSV() throws Throwable
|
public void testExportCSV() throws Throwable
|
||||||
{
|
{
|
||||||
ExportDBTask task = new ExportDBTask(filename -> {
|
ExportDBTask task = new ExportDBTask(testContext, filename -> {
|
||||||
assertThat(filename, is(not(nullValue())));
|
assertThat(filename, is(not(nullValue())));
|
||||||
|
|
||||||
File f = new File(filename);
|
File f = new File(filename);
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ import java.io.*;
|
|||||||
*/
|
*/
|
||||||
public class HabitsApplication extends Application
|
public class HabitsApplication extends Application
|
||||||
{
|
{
|
||||||
private static Context context;
|
private Context context;
|
||||||
|
|
||||||
private static AppComponent component;
|
private static AppComponent component;
|
||||||
|
|
||||||
@@ -58,26 +58,14 @@ public class HabitsApplication extends Application
|
|||||||
HabitsApplication.component = component;
|
HabitsApplication.component = component;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
|
||||||
@Deprecated
|
|
||||||
public static Context getContext()
|
|
||||||
{
|
|
||||||
if (context == null) throw new RuntimeException("context is null");
|
|
||||||
return context;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isTestMode()
|
public static boolean isTestMode()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (context != null)
|
Class.forName ("org.isoron.uhabits.BaseAndroidTest");
|
||||||
{
|
|
||||||
String testClass = "org.isoron.uhabits.BaseAndroidTest";
|
|
||||||
context.getClassLoader().loadClass(testClass);
|
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch (final Exception e)
|
catch (final ClassNotFoundException e)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -87,7 +75,7 @@ public class HabitsApplication extends Application
|
|||||||
public void onCreate()
|
public void onCreate()
|
||||||
{
|
{
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
HabitsApplication.context = this;
|
context = this;
|
||||||
|
|
||||||
component = DaggerAppComponent
|
component = DaggerAppComponent
|
||||||
.builder()
|
.builder()
|
||||||
@@ -96,11 +84,11 @@ public class HabitsApplication extends Application
|
|||||||
|
|
||||||
if (isTestMode())
|
if (isTestMode())
|
||||||
{
|
{
|
||||||
File db = DatabaseUtils.getDatabaseFile();
|
File db = DatabaseUtils.getDatabaseFile(context);
|
||||||
if (db.exists()) db.delete();
|
if (db.exists()) db.delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
DatabaseUtils.initializeActiveAndroid();
|
DatabaseUtils.initializeActiveAndroid(context);
|
||||||
|
|
||||||
widgetUpdater = component.getWidgetUpdater();
|
widgetUpdater = component.getWidgetUpdater();
|
||||||
widgetUpdater.startListening();
|
widgetUpdater.startListening();
|
||||||
@@ -125,7 +113,7 @@ public class HabitsApplication extends Application
|
|||||||
@Override
|
@Override
|
||||||
public void onTerminate()
|
public void onTerminate()
|
||||||
{
|
{
|
||||||
HabitsApplication.context = null;
|
context = null;
|
||||||
ActiveAndroid.dispose();
|
ActiveAndroid.dispose();
|
||||||
|
|
||||||
reminderScheduler.stopListening();
|
reminderScheduler.stopListening();
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ public class BaseSystem
|
|||||||
|
|
||||||
if (context == null) throw new RuntimeException(
|
if (context == null) throw new RuntimeException(
|
||||||
"application context should not be null");
|
"application context should not be null");
|
||||||
File dir = FileUtils.getFilesDir("Logs");
|
File dir = FileUtils.getFilesDir(context, "Logs");
|
||||||
if (dir == null) throw new IOException("log dir should not be null");
|
if (dir == null) throw new IOException("log dir should not be null");
|
||||||
|
|
||||||
File logFile =
|
File logFile =
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import javax.inject.*;
|
|||||||
public class ListHabitsController
|
public class ListHabitsController
|
||||||
implements HabitCardListController.HabitListener
|
implements HabitCardListController.HabitListener
|
||||||
{
|
{
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final ListHabitsScreen screen;
|
private final ListHabitsScreen screen;
|
||||||
|
|
||||||
@@ -70,6 +71,8 @@ public class ListHabitsController
|
|||||||
|
|
||||||
private ExportCSVTaskFactory exportCSVFactory;
|
private ExportCSVTaskFactory exportCSVFactory;
|
||||||
|
|
||||||
|
private ExportDBTaskFactory exportDBFactory;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ListHabitsController(@NonNull BaseSystem system,
|
public ListHabitsController(@NonNull BaseSystem system,
|
||||||
@NonNull CommandRunner commandRunner,
|
@NonNull CommandRunner commandRunner,
|
||||||
@@ -82,7 +85,8 @@ public class ListHabitsController
|
|||||||
@NonNull WidgetUpdater widgetUpdater,
|
@NonNull WidgetUpdater widgetUpdater,
|
||||||
@NonNull
|
@NonNull
|
||||||
ImportDataTaskFactory importTaskFactory,
|
ImportDataTaskFactory importTaskFactory,
|
||||||
@NonNull ExportCSVTaskFactory exportCSVFactory)
|
@NonNull ExportCSVTaskFactory exportCSVFactory,
|
||||||
|
@NonNull ExportDBTaskFactory exportDBFactory)
|
||||||
{
|
{
|
||||||
this.adapter = adapter;
|
this.adapter = adapter;
|
||||||
this.commandRunner = commandRunner;
|
this.commandRunner = commandRunner;
|
||||||
@@ -95,6 +99,7 @@ public class ListHabitsController
|
|||||||
this.widgetUpdater = widgetUpdater;
|
this.widgetUpdater = widgetUpdater;
|
||||||
this.importTaskFactory = importTaskFactory;
|
this.importTaskFactory = importTaskFactory;
|
||||||
this.exportCSVFactory = exportCSVFactory;
|
this.exportCSVFactory = exportCSVFactory;
|
||||||
|
this.exportDBFactory = exportDBFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onExportCSV()
|
public void onExportCSV()
|
||||||
@@ -110,7 +115,7 @@ public class ListHabitsController
|
|||||||
|
|
||||||
public void onExportDB()
|
public void onExportDB()
|
||||||
{
|
{
|
||||||
taskRunner.execute(new ExportDBTask(filename -> {
|
taskRunner.execute(exportDBFactory.create(filename -> {
|
||||||
if (filename != null) screen.showSendFileScreen(filename);
|
if (filename != null) screen.showSendFileScreen(filename);
|
||||||
else screen.showMessage(R.string.could_not_export);
|
else screen.showMessage(R.string.could_not_export);
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import android.content.*;
|
|||||||
import android.graphics.drawable.*;
|
import android.graphics.drawable.*;
|
||||||
import android.os.*;
|
import android.os.*;
|
||||||
import android.support.annotation.*;
|
import android.support.annotation.*;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
import android.util.*;
|
import android.util.*;
|
||||||
import android.widget.*;
|
import android.widget.*;
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,14 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.io;
|
package org.isoron.uhabits.io;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import com.activeandroid.ActiveAndroid;
|
import com.activeandroid.ActiveAndroid;
|
||||||
|
|
||||||
|
import org.isoron.uhabits.AppContext;
|
||||||
import org.isoron.uhabits.models.*;
|
import org.isoron.uhabits.models.*;
|
||||||
import org.isoron.uhabits.utils.DatabaseUtils;
|
import org.isoron.uhabits.utils.DatabaseUtils;
|
||||||
import org.isoron.uhabits.utils.FileUtils;
|
import org.isoron.uhabits.utils.FileUtils;
|
||||||
@@ -39,10 +41,14 @@ import javax.inject.*;
|
|||||||
*/
|
*/
|
||||||
public class LoopDBImporter extends AbstractImporter
|
public class LoopDBImporter extends AbstractImporter
|
||||||
{
|
{
|
||||||
|
@NonNull
|
||||||
|
private Context context;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public LoopDBImporter(@NonNull HabitList habits)
|
public LoopDBImporter(@NonNull @AppContext Context context, @NonNull HabitList habits)
|
||||||
{
|
{
|
||||||
super(habits);
|
super(habits);
|
||||||
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -68,8 +74,8 @@ public class LoopDBImporter extends AbstractImporter
|
|||||||
public void importHabitsFromFile(@NonNull File file) throws IOException
|
public void importHabitsFromFile(@NonNull File file) throws IOException
|
||||||
{
|
{
|
||||||
ActiveAndroid.dispose();
|
ActiveAndroid.dispose();
|
||||||
File originalDB = DatabaseUtils.getDatabaseFile();
|
File originalDB = DatabaseUtils.getDatabaseFile(context);
|
||||||
FileUtils.copy(file, originalDB);
|
FileUtils.copy(file, originalDB);
|
||||||
DatabaseUtils.initializeActiveAndroid();
|
DatabaseUtils.initializeActiveAndroid(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ package org.isoron.uhabits.models.sqlite.records;
|
|||||||
import android.annotation.*;
|
import android.annotation.*;
|
||||||
import android.database.*;
|
import android.database.*;
|
||||||
import android.support.annotation.*;
|
import android.support.annotation.*;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.Nullable;
|
||||||
|
|
||||||
import com.activeandroid.*;
|
import com.activeandroid.*;
|
||||||
import com.activeandroid.annotation.*;
|
import com.activeandroid.annotation.*;
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ public class PebbleReceiver extends PebbleDataReceiver
|
|||||||
public static final UUID WATCHAPP_UUID =
|
public static final UUID WATCHAPP_UUID =
|
||||||
UUID.fromString("82629d99-8ea6-4631-a022-9ca77a12a058");
|
UUID.fromString("82629d99-8ea6-4631-a022-9ca77a12a058");
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private Context context;
|
||||||
|
|
||||||
private HabitList allHabits;
|
private HabitList allHabits;
|
||||||
|
|
||||||
private CommandRunner commandRunner;
|
private CommandRunner commandRunner;
|
||||||
@@ -61,6 +64,8 @@ public class PebbleReceiver extends PebbleDataReceiver
|
|||||||
if (context == null) throw new RuntimeException("context is null");
|
if (context == null) throw new RuntimeException("context is null");
|
||||||
if (data == null) throw new RuntimeException("data is null");
|
if (data == null) throw new RuntimeException("data is null");
|
||||||
|
|
||||||
|
this.context = context;
|
||||||
|
|
||||||
HabitsApplication app =
|
HabitsApplication app =
|
||||||
(HabitsApplication) context.getApplicationContext();
|
(HabitsApplication) context.getApplicationContext();
|
||||||
|
|
||||||
@@ -136,7 +141,7 @@ public class PebbleReceiver extends PebbleDataReceiver
|
|||||||
|
|
||||||
private void sendDict(@NonNull PebbleDictionary dict)
|
private void sendDict(@NonNull PebbleDictionary dict)
|
||||||
{
|
{
|
||||||
PebbleKit.sendDataToPebble(HabitsApplication.getContext(),
|
PebbleKit.sendDataToPebble(context,
|
||||||
PebbleReceiver.WATCHAPP_UUID, dict);
|
PebbleReceiver.WATCHAPP_UUID, dict);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,13 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.tasks;
|
package org.isoron.uhabits.tasks;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.support.annotation.*;
|
import android.support.annotation.*;
|
||||||
|
|
||||||
import com.google.auto.factory.*;
|
import com.google.auto.factory.*;
|
||||||
|
|
||||||
|
import org.isoron.uhabits.AppContext;
|
||||||
|
import org.isoron.uhabits.activities.ActivityContext;
|
||||||
import org.isoron.uhabits.io.*;
|
import org.isoron.uhabits.io.*;
|
||||||
import org.isoron.uhabits.models.*;
|
import org.isoron.uhabits.models.*;
|
||||||
import org.isoron.uhabits.utils.*;
|
import org.isoron.uhabits.utils.*;
|
||||||
@@ -35,6 +38,9 @@ public class ExportCSVTask implements Task
|
|||||||
{
|
{
|
||||||
private String archiveFilename;
|
private String archiveFilename;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private final Context context;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final List<Habit> selectedHabits;
|
private final List<Habit> selectedHabits;
|
||||||
|
|
||||||
@@ -44,10 +50,12 @@ public class ExportCSVTask implements Task
|
|||||||
@NonNull
|
@NonNull
|
||||||
private final HabitList habitList;
|
private final HabitList habitList;
|
||||||
|
|
||||||
public ExportCSVTask(@Provided @NonNull HabitList habitList,
|
public ExportCSVTask(@Provided @AppContext @NonNull Context context,
|
||||||
|
@Provided @NonNull HabitList habitList,
|
||||||
@NonNull List<Habit> selectedHabits,
|
@NonNull List<Habit> selectedHabits,
|
||||||
@NonNull Listener listener)
|
@NonNull Listener listener)
|
||||||
{
|
{
|
||||||
|
this.context = context;
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
this.habitList = habitList;
|
this.habitList = habitList;
|
||||||
this.selectedHabits = selectedHabits;
|
this.selectedHabits = selectedHabits;
|
||||||
@@ -58,7 +66,7 @@ public class ExportCSVTask implements Task
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File dir = FileUtils.getFilesDir("CSV");
|
File dir = FileUtils.getFilesDir(context, "CSV");
|
||||||
if (dir == null) return;
|
if (dir == null) return;
|
||||||
|
|
||||||
HabitsCSVExporter exporter;
|
HabitsCSVExporter exporter;
|
||||||
|
|||||||
@@ -19,22 +19,33 @@
|
|||||||
|
|
||||||
package org.isoron.uhabits.tasks;
|
package org.isoron.uhabits.tasks;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
import android.support.annotation.*;
|
import android.support.annotation.*;
|
||||||
|
|
||||||
|
import com.google.auto.factory.AutoFactory;
|
||||||
|
import com.google.auto.factory.Provided;
|
||||||
|
|
||||||
|
import org.isoron.uhabits.AppContext;
|
||||||
|
import org.isoron.uhabits.activities.ActivityContext;
|
||||||
import org.isoron.uhabits.utils.*;
|
import org.isoron.uhabits.utils.*;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
|
@AutoFactory(allowSubclasses = true)
|
||||||
public class ExportDBTask implements Task
|
public class ExportDBTask implements Task
|
||||||
{
|
{
|
||||||
private String filename;
|
private String filename;
|
||||||
|
|
||||||
|
@NonNull
|
||||||
|
private Context context;
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
private final Listener listener;
|
private final Listener listener;
|
||||||
|
|
||||||
public ExportDBTask(@NonNull Listener listener)
|
public ExportDBTask(@Provided @AppContext @NonNull Context context, @NonNull Listener listener)
|
||||||
{
|
{
|
||||||
this.listener = listener;
|
this.listener = listener;
|
||||||
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -44,10 +55,10 @@ public class ExportDBTask implements Task
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File dir = FileUtils.getFilesDir("Backups");
|
File dir = FileUtils.getFilesDir(context, "Backups");
|
||||||
if (dir == null) return;
|
if (dir == null) return;
|
||||||
|
|
||||||
filename = DatabaseUtils.saveDatabaseCopy(dir);
|
filename = DatabaseUtils.saveDatabaseCopy(context, dir);
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -47,9 +47,8 @@ public abstract class DatabaseUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
public static File getDatabaseFile()
|
public static File getDatabaseFile(Context context)
|
||||||
{
|
{
|
||||||
Context context = HabitsApplication.getContext();
|
|
||||||
String databaseFilename = getDatabaseFilename();
|
String databaseFilename = getDatabaseFilename();
|
||||||
String root = context.getFilesDir().getPath();
|
String root = context.getFilesDir().getPath();
|
||||||
|
|
||||||
@@ -68,9 +67,8 @@ public abstract class DatabaseUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public static void initializeActiveAndroid()
|
public static void initializeActiveAndroid(Context context)
|
||||||
{
|
{
|
||||||
Context context = HabitsApplication.getContext();
|
|
||||||
Configuration dbConfig = new Configuration.Builder(context)
|
Configuration dbConfig = new Configuration.Builder(context)
|
||||||
.setDatabaseName(getDatabaseFilename())
|
.setDatabaseName(getDatabaseFilename())
|
||||||
.setDatabaseVersion(BuildConfig.databaseVersion)
|
.setDatabaseVersion(BuildConfig.databaseVersion)
|
||||||
@@ -82,14 +80,14 @@ public abstract class DatabaseUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||||
public static String saveDatabaseCopy(File dir) throws IOException
|
public static String saveDatabaseCopy(Context context, File dir) throws IOException
|
||||||
{
|
{
|
||||||
SimpleDateFormat dateFormat = DateFormats.getBackupDateFormat();
|
SimpleDateFormat dateFormat = DateFormats.getBackupDateFormat();
|
||||||
String date = dateFormat.format(DateUtils.getLocalTime());
|
String date = dateFormat.format(DateUtils.getLocalTime());
|
||||||
String format = "%s/Loop Habits Backup %s.db";
|
String format = "%s/Loop Habits Backup %s.db";
|
||||||
String filename = String.format(format, dir.getAbsolutePath(), date);
|
String filename = String.format(format, dir.getAbsolutePath(), date);
|
||||||
|
|
||||||
File db = getDatabaseFile();
|
File db = getDatabaseFile(context);
|
||||||
File dbCopy = new File(filename);
|
File dbCopy = new File(filename);
|
||||||
FileUtils.copy(db, dbCopy);
|
FileUtils.copy(db, dbCopy);
|
||||||
|
|
||||||
|
|||||||
@@ -87,9 +87,8 @@ public abstract class FileUtils
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static File getFilesDir(@Nullable String relativePath)
|
public static File getFilesDir(@NonNull Context context, @Nullable String relativePath)
|
||||||
{
|
{
|
||||||
Context context = HabitsApplication.getContext();
|
|
||||||
File externalFilesDirs[] =
|
File externalFilesDirs[] =
|
||||||
ContextCompat.getExternalFilesDirs(context, null);
|
ContextCompat.getExternalFilesDirs(context, null);
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,8 @@ public class ListHabitsControllerTest extends BaseUnitTest
|
|||||||
|
|
||||||
private ExportCSVTaskFactory exportCSVFactory;
|
private ExportCSVTaskFactory exportCSVFactory;
|
||||||
|
|
||||||
|
private ExportDBTaskFactory exportDBFactory;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setUp()
|
public void setUp()
|
||||||
{
|
{
|
||||||
@@ -73,11 +75,12 @@ public class ListHabitsControllerTest extends BaseUnitTest
|
|||||||
widgetUpdater = mock(WidgetUpdater.class);
|
widgetUpdater = mock(WidgetUpdater.class);
|
||||||
importTaskFactory = mock(ImportDataTaskFactory.class);
|
importTaskFactory = mock(ImportDataTaskFactory.class);
|
||||||
exportCSVFactory = mock(ExportCSVTaskFactory.class);
|
exportCSVFactory = mock(ExportCSVTaskFactory.class);
|
||||||
|
exportDBFactory = mock(ExportDBTaskFactory.class);
|
||||||
|
|
||||||
controller =
|
controller =
|
||||||
spy(new ListHabitsController(system, commandRunner, habitList,
|
spy(new ListHabitsController(system, commandRunner, habitList,
|
||||||
adapter, screen, prefs, reminderScheduler, taskRunner,
|
adapter, screen, prefs, reminderScheduler, taskRunner,
|
||||||
widgetUpdater, importTaskFactory, exportCSVFactory));
|
widgetUpdater, importTaskFactory, exportCSVFactory, exportDBFactory));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user