Handle Comments
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 @@
}
//-----------------------------------------------------------------------
- @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
- }
+ DateUtils.toCalendar(null, zone);
}
//-----------------------------------------------------------------------
- @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());
- }
-
- //-----------------------------------------------------------------------
- @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);
}
//-----------------------------------------------------------------------