Write tests for receivers

This commit is contained in:
2016-08-04 07:34:38 -04:00
parent c961045b63
commit 2d40fb0b82
11 changed files with 216 additions and 14 deletions

View File

@@ -19,12 +19,15 @@
package org.isoron.uhabits;
import android.content.*;
import org.isoron.uhabits.activities.habits.list.model.*;
import org.isoron.uhabits.commands.*;
import org.isoron.uhabits.intents.*;
import org.isoron.uhabits.io.*;
import org.isoron.uhabits.models.*;
import org.isoron.uhabits.models.sqlite.*;
import org.isoron.uhabits.notifications.*;
import org.isoron.uhabits.preferences.*;
import org.isoron.uhabits.tasks.*;
import org.isoron.uhabits.utils.*;
@@ -40,6 +43,9 @@ public interface AppComponent
{
CommandRunner getCommandRunner();
@AppContext
Context getContext();
CreateHabitCommandFactory getCreateHabitCommandFactory();
DirFinder getDirFinder();
@@ -48,6 +54,8 @@ public interface AppComponent
GenericImporter getGenericImporter();
HabitCardListCache getHabitCardListCache();
HabitList getHabitList();
HabitLogger getHabitsLogger();
@@ -58,6 +66,8 @@ public interface AppComponent
ModelFactory getModelFactory();
NotificationTray getNotificationTray();
PendingIntentFactory getPendingIntentFactory();
Preferences getPreferences();
@@ -69,6 +79,4 @@ public interface AppComponent
WidgetPreferences getWidgetPreferences();
WidgetUpdater getWidgetUpdater();
HabitCardListCache getHabitCardListCache();
}

View File

@@ -19,7 +19,7 @@
package org.isoron.uhabits.commands;
import org.isoron.uhabits.models.Habit;
import org.isoron.uhabits.models.*;
/**
* Command to toggle a repetition.

View File

@@ -36,6 +36,7 @@ import javax.inject.*;
import static android.graphics.BitmapFactory.*;
import static org.isoron.uhabits.utils.RingtoneUtils.*;
@AppScope
public class NotificationTray
{
@NonNull

View File

@@ -68,8 +68,8 @@ public class ReminderController
long now = DateUtils.getLocalTime();
long reminderTime = now + snoozeInterval * 60 * 1000;
reminderScheduler.schedule(habit, reminderTime);
reminderScheduler.schedule(habit, reminderTime);
notificationTray.cancel(habit);
}

View File

@@ -102,7 +102,7 @@ public class ReminderReceiver extends BroadcastReceiver
}
@ReceiverScope
@Component(dependencies = AppComponent.class, modules = AppModule.class)
@Component(dependencies = AppComponent.class)
interface ReminderComponent
{
ReminderController getReminderController();

View File

@@ -87,7 +87,7 @@ public class WidgetReceiver extends BroadcastReceiver
}
@ReceiverScope
@Component(dependencies = AppComponent.class, modules = AppModule.class)
@Component(dependencies = AppComponent.class)
interface WidgetComponent
{
WidgetController getWidgetController();