Fix errors

This commit is contained in:
2017-07-22 20:05:01 -04:00
parent a8aa6f192c
commit 57dc19550d
4 changed files with 9 additions and 10 deletions

View File

@@ -34,7 +34,7 @@ public class CheckmarkListTest extends BaseUnitTest
{
private long dayLength;
private long today;
private Timestamp today;
private Habit nonDailyHabit;
@@ -55,6 +55,7 @@ public class CheckmarkListTest extends BaseUnitTest
numericalHabit = fixtures.createNumericalHabit();
habitList.add(numericalHabit);
today = DateUtils.getToday();
}
@Test
@@ -285,8 +286,8 @@ public class CheckmarkListTest extends BaseUnitTest
@Test
public void test_getValues_withValidInterval()
{
long from = today - 15 * dayLength;
long to = today - 5 * dayLength;
Timestamp from = today.minus(15);
Timestamp to = today.minus(5);
int[] expectedValues = {
CHECKED_EXPLICITLY,
@@ -302,10 +303,7 @@ public class CheckmarkListTest extends BaseUnitTest
UNCHECKED
};
int[] actualValues = nonDailyHabit
.getCheckmarks()
.getValues(new Timestamp(from), new Timestamp(to));
int[] actualValues = nonDailyHabit.getCheckmarks().getValues(from, to);
assertThat(actualValues, equalTo(expectedValues));
}

View File

@@ -152,7 +152,7 @@ public class ListHabitsBehaviorTest extends BaseUnitTest
@Test
public void testOnStartup_firstLaunch()
{
long today = DateUtils.getStartOfToday();
Timestamp today = DateUtils.getToday();
when(prefs.isFirstRun()).thenReturn(true);
behavior.onStartup();

View File

@@ -20,6 +20,7 @@
package org.isoron.uhabits.core.utils;
import org.isoron.uhabits.core.*;
import org.isoron.uhabits.core.models.*;
import org.junit.*;
import java.util.*;
@@ -34,7 +35,7 @@ public class DateUtilsTest extends BaseUnitTest
public void testFormatHeaderDate()
{
long timestamp = timestamp(2015, DECEMBER, 31);
GregorianCalendar date = DateUtils.getCalendar(timestamp);
GregorianCalendar date = new Timestamp(timestamp).toCalendar();
String formatted = DateUtils.formatHeaderDate(date);
assertThat(formatted, equalTo("Thu\n31"));
}