null check description

This commit is contained in:
Rechee Jozil
2020-02-01 11:08:06 -08:00
parent 2e64da4cac
commit 66b4c48d92
5 changed files with 6 additions and 6 deletions

View File

@@ -87,7 +87,7 @@ public class HabitBullCSVImporter extends AbstractImporter
{
h = modelFactory.buildHabit();
h.setName(name);
h.setDescription(description);
h.setDescription(description == null ? "" : description);
h.setFrequency(Frequency.DAILY);
habitList.add(h);
map.put(name, h);

View File

@@ -101,7 +101,7 @@ public class RewireDBImporter extends AbstractImporter
Habit habit = modelFactory.buildHabit();
habit.setName(name);
habit.setDescription(description);
habit.setDescription(description == null ? "" : description);
int periods[] = { 7, 31, 365 };
int numerator, denominator;

View File

@@ -127,7 +127,7 @@ public class TickmateDBImporter extends AbstractImporter
Habit habit = modelFactory.buildHabit();
habit.setName(name);
habit.setDescription(description);
habit.setDescription(description == null ? "" : description);
habit.setFrequency(Frequency.DAILY);
habitList.add(habit);

View File

@@ -148,9 +148,9 @@ public class Habit
return data.description;
}
public synchronized void setDescription(@Nullable String description)
public synchronized void setDescription(@NonNull String description)
{
data.description = description == null ? "" : description;
data.description = description;
}
@NonNull

View File

@@ -226,7 +226,7 @@ public class HabitListTest extends BaseUnitTest
Habit h2 = fixtures.createEmptyHabit();
h2.setName("Wake up early");
h2.setQuestion("Did you wake up before 6am?");
h2.setDescription(null);
h2.setDescription("");
h2.setFrequency(new Frequency(2, 3));
h2.setColor(5);