Update tests

* Exclude transitive deps for instrumentTest hack
* Convert RepeatAfterCompleteTest to Robolectric
pull/46/head
Alex Baker 11 years ago
parent 0e6df44e95
commit 77e4e5f001

@ -92,6 +92,10 @@ dependencies {
testCompile 'junit:junit:4.10'
testCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
// hack to get android studio to import libraries
instrumentTestCompile 'junit:junit:4.10'
instrumentTestCompile 'org.robolectric:robolectric:2.3-SNAPSHOT'
instrumentTestCompile('junit:junit:4.10') {
transitive = false
}
instrumentTestCompile('org.robolectric:robolectric:2.3-SNAPSHOT') {
transitive = false
}
}

@ -9,23 +9,33 @@ import com.google.ical.values.Frequency;
import com.google.ical.values.RRule;
import com.google.ical.values.Weekday;
import com.google.ical.values.WeekdayNum;
import com.todoroo.andlib.test.TodorooTestCase;
import com.todoroo.andlib.test.TodorooRobolectricTestCase;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.data.Task;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.TimeZone;
public class RepeatAfterCompleteTests extends TodorooTestCase {
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
@RunWith(RobolectricTestRunner.class)
public class RepeatAfterCompleteTest extends TodorooRobolectricTestCase {
private Task task;
private long nextDueDate;
private RRule rrule;
@Override
protected void setUp() throws Exception {
@Before
public void setUp() throws Exception {
super.setUp();
task = new Task();
task.setValue(Task.COMPLETION_DATE, DateUtilities.now());
@ -34,6 +44,7 @@ public class RepeatAfterCompleteTests extends TodorooTestCase {
// --- date with time tests
@Test
public void testSubDailyFreqs() throws ParseException {
task.setValue(Task.DUE_DATE, DateUtilities.now() - DateUtilities.ONE_WEEK);
@ -59,6 +70,7 @@ public class RepeatAfterCompleteTests extends TodorooTestCase {
}
}
@Test
public void testDailyAndGreaterFreqs() throws ParseException {
task.setValue(Task.DUE_DATE,
Task.createDueDate(Task.URGENCY_SPECIFIC_DAY,
@ -89,6 +101,7 @@ public class RepeatAfterCompleteTests extends TodorooTestCase {
}
}
@Test
public void testTimeZoneLate() throws ParseException {
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
task.setValue(Task.DUE_DATE, DateUtilities.now() + DateUtilities.ONE_WEEK);
@ -127,5 +140,4 @@ public class RepeatAfterCompleteTests extends TodorooTestCase {
days.add(new WeekdayNum(0, wd));
rrule.setByDay(days);
}
}
Loading…
Cancel
Save