You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ki...@apache.org on 2016/04/24 02:54:44 UTC

[lang] LANG-1220: Add tests for missed branches in DateUtils

Repository: commons-lang
Updated Branches:
  refs/heads/master c99a78775 -> fac65b868


LANG-1220: Add tests for missed branches in DateUtils


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/fac65b86
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/fac65b86
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/fac65b86

Branch: refs/heads/master
Commit: fac65b868c549d28b786568636bbc8362d2a78f2
Parents: c99a787
Author: Casey Scarborough <ca...@gmail.com>
Authored: Sat Apr 23 13:46:21 2016 -0400
Committer: Bruno P. Kinoshita <ki...@apache.org>
Committed: Sun Apr 24 12:54:25 2016 +1200

----------------------------------------------------------------------
 .../commons/lang3/time/DateUtilsTest.java       | 52 +++++++++++++++++++-
 1 file changed, 51 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fac65b86/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
index 2710432..0b80ab6 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
@@ -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 {