LANG-1220: Add tests for missed branches in DateUtils

This commit is contained in:
Casey Scarborough 2016-04-23 13:46:21 -04:00 committed by Bruno P. Kinoshita
parent c99a787752
commit fac65b868c
1 changed files with 51 additions and 1 deletions

View File

@ -170,10 +170,20 @@ public class DateUtilsTest {
}
@Test(expected = IllegalArgumentException.class)
public void testIsDameDay_DateNullNull() throws Exception {
public void testIsSameDay_DateNullNull() throws Exception {
DateUtils.isSameDay((Date) null, (Date) null);
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameDay_DateNullNotNull() throws Exception {
DateUtils.isSameDay((Date) null, new Date());
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameDay_DateNotNullNull() throws Exception {
DateUtils.isSameDay(new Date(), (Date) null);
}
//-----------------------------------------------------------------------
@Test
public void testIsSameDay_Cal() {
@ -193,6 +203,16 @@ public class DateUtilsTest {
DateUtils.isSameDay((Calendar) null, (Calendar) null);
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameDay_CalNullNotNull() throws Exception {
DateUtils.isSameDay((Calendar) null, Calendar.getInstance());
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameDay_CalNotNullNull() throws Exception {
DateUtils.isSameDay(Calendar.getInstance(), (Calendar) null);
}
//-----------------------------------------------------------------------
@Test
public void testIsSameInstant_Date() {
@ -212,6 +232,16 @@ public class DateUtilsTest {
DateUtils.isSameInstant((Date) null, (Date) null);
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameInstant_DateNullNotNull() throws Exception {
DateUtils.isSameInstant((Date) null, new Date());
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameInstant_DateNotNullNull() throws Exception {
DateUtils.isSameInstant(new Date(), (Date) null);
}
//-----------------------------------------------------------------------
@Test
public void testIsSameInstant_Cal() {
@ -232,6 +262,16 @@ public class DateUtilsTest {
DateUtils.isSameInstant((Calendar) null, (Calendar) null);
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameInstant_CalNullNotNull() throws Exception {
DateUtils.isSameInstant((Calendar) null, Calendar.getInstance());
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameInstant_CalNotNullNull() throws Exception {
DateUtils.isSameInstant(Calendar.getInstance(), (Calendar) null);
}
//-----------------------------------------------------------------------
@Test
public void testIsSameLocalTime_Cal() {
@ -260,6 +300,16 @@ public class DateUtilsTest {
DateUtils.isSameLocalTime((Calendar) null, (Calendar) null);
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameLocalTime_CalNullNotNull() throws Exception {
DateUtils.isSameLocalTime((Calendar) null, Calendar.getInstance());
}
@Test(expected = IllegalArgumentException.class)
public void testIsSameLocalTime_CalNotNullNull() throws Exception {
DateUtils.isSameLocalTime(Calendar.getInstance(), (Calendar) null);
}
//-----------------------------------------------------------------------
@Test
public void testParseDate() throws Exception {