Handle Comments

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

Branch: refs/heads/master
Commit: 8ac857c41ec8ae02e57eb0c1c1a012525e7e14b9
Parents: d9a2c69
Author: Kaiyuan Wang <wangkaiyua...@gmail.com>
Authored: Sun Sep 25 13:13:03 2016 -0500
Committer: Kaiyuan Wang <wangkaiyua...@gmail.com>
Committed: Sun Sep 25 13:13:03 2016 -0500

----------------------------------------------------------------------
 .../commons/lang3/time/DateUtilsTest.java       | 45 ++++----------------
 1 file changed, 9 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/8ac857c4/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 d4d1917..bb6e59f 100644
--- a/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/time/DateUtilsTest.java
@@ -695,56 +695,29 @@ public class DateUtilsTest {
     }
     
     //-----------------------------------------------------------------------
-    @Test
-    public void testToCalendarWithDateNotNull() {
-        assertEquals("Convert Date and TimeZone to a Calendar, but failed to 
get the Date back", date1, DateUtils.toCalendar(date1, zone).getTime());
-    }
-    
-    //-----------------------------------------------------------------------
-    @Test
+    @Test(expected=NullPointerException.class)
     public void testToCalendarWithDateNull() {
-        try {
-            DateUtils.toCalendar(null, zone);
-            fail("Expected NullPointerException to be thrown when Date is 
null");
-        } catch(final NullPointerException npe) {
-            // expected
-        }
-    }
-    
-    //-----------------------------------------------------------------------
-    @Test
-    public void testToCalendarWithTimeZoneNotNull() {
-       assertEquals("Convert Date and TimeZone to a Calendar, but failed to 
get the TimeZone back", zone, DateUtils.toCalendar(date1, zone).getTimeZone());
+        DateUtils.toCalendar(null, zone);
     }
     
     //-----------------------------------------------------------------------
-    @Test
+    @Test(expected=NullPointerException.class)
     public void testToCalendarWithTimeZoneNull() {
-        try {
-            DateUtils.toCalendar(date1, null);
-            fail("Expected NullPointerException to be thrown when TimeZone is 
null");
-        } catch(final NullPointerException npe) {
-            // expected
-        }
+        DateUtils.toCalendar(date1, null);
     }
     
     //-----------------------------------------------------------------------
     @Test
     public void testToCalendarWithDateAndTimeZoneNotNull() {
-       Calendar c = DateUtils.toCalendar(date2, defaultZone);
-       assertEquals("Convert Date and TimeZone to a Calendar, but failed to 
get the Date back", date2, c.getTime());
-       assertEquals("Convert Date and TimeZone to a Calendar, but failed to 
get the TimeZone back", defaultZone, c.getTimeZone());
+        Calendar c = DateUtils.toCalendar(date2, defaultZone);
+        assertEquals("Convert Date and TimeZone to a Calendar, but failed to 
get the Date back", date2, c.getTime());
+        assertEquals("Convert Date and TimeZone to a Calendar, but failed to 
get the TimeZone back", defaultZone, c.getTimeZone());
     }
     
     //-----------------------------------------------------------------------
-    @Test
+    @Test(expected=NullPointerException.class)
     public void testToCalendarWithDateAndTimeZoneNull() {
-       try {
-               DateUtils.toCalendar(null, null);
-            fail("Expected NullPointerException to be thrown when both Date 
and TimeZone are null");
-        } catch(final NullPointerException npe) {
-            // expected
-        }
+        DateUtils.toCalendar(null, null);
     }
 
     //-----------------------------------------------------------------------

Reply via email to