@@ -0,0 +1,1645 @@
+package com.tom_e_white.chickenalerts;%0A%0Aimport java.util.Calendar;%0Aimport java.util.TimeZone;%0A%0Aimport junit.framework.TestCase;%0A%0Apublic class AlertTimeCalculatorTest extends TestCase %7B%0A%09%0A%09public void testToday() %7B%0A%09%09Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(%22GMT%22));%0A%09%09cal.set(Calendar.YEAR, 2013);%0A%09%09cal.set(Calendar.MONTH, Calendar.FEBRUARY);%0A%09%09cal.set(Calendar.DATE, 3);%0A%09%09cal.set(Calendar.HOUR_OF_DAY, 12);%0A%09%09cal.set(Calendar.MINUTE, 0);%0A%09%09cal.set(Calendar.SECOND, 0);%0A%09%09%0A%09%09AlertTimeCalculator calculator = new AlertTimeCalculator();%0A%09%09Calendar nextAlert = calculator.calculateNextAlert(cal);%0A%09%09%0A%09%09assertEquals(nextAlert.get(Calendar.YEAR), 2013);%0A%09%09assertEquals(nextAlert.get(Calendar.MONTH), Calendar.FEBRUARY);%0A%09%09assertEquals(nextAlert.get(Calendar.DATE), 3);%0A%09%09assertEquals(nextAlert.get(Calendar.HOUR_OF_DAY), 17);%0A%09%09assertEquals(nextAlert.get(Calendar.MINUTE), 49);%0A%09%7D%0A%0A%09public void testTomorrow() %7B%0A%09%09Calendar cal = Calendar.getInstance(TimeZone.getTimeZone(%22GMT%22));%0A%09%09cal.set(Calendar.YEAR, 2013);%0A%09%09cal.set(Calendar.MONTH, Calendar.FEBRUARY);%0A%09%09cal.set(Calendar.DATE, 3);%0A%09%09cal.set(Calendar.HOUR_OF_DAY, 18);%0A%09%09cal.set(Calendar.MINUTE, 0);%0A%09%09cal.set(Calendar.SECOND, 0);%0A%09%09%0A%09%09AlertTimeCalculator calculator = new AlertTimeCalculator();%0A%09%09Calendar nextAlert = calculator.calculateNextAlert(cal);%0A%09%09%0A%09%09assertEquals(nextAlert.get(Calendar.YEAR), 2013);%0A%09%09assertEquals(nextAlert.get(Calendar.MONTH), Calendar.FEBRUARY);%0A%09%09assertEquals(nextAlert.get(Calendar.DATE), 4); // next day%0A%09%09assertEquals(nextAlert.get(Calendar.HOUR_OF_DAY), 17);%0A%09%09assertEquals(nextAlert.get(Calendar.MINUTE), 51); // sunset is 2 mins later%0A%09%7D%0A%7D%0A

Add unit test.