1 16 package org.quartz.impl.calendar; 17 18 import org.quartz.SerializationTestSupport; 19 20 23 public class DailyCalendarTest extends SerializationTestSupport { 24 private static final String [] VERSIONS = new String [] {"1.5.2"}; 25 26 public void testStringStartEndTimes() { 27 DailyCalendar dailyCalendar = new DailyCalendar("TestCal", "1:20", "14:50"); 28 assertTrue(dailyCalendar.toString().indexOf("01:20:00:000 - 14:50:00:000") > 0); 29 30 dailyCalendar = new DailyCalendar("TestCal", "1:20:1:456", "14:50:15:2"); 31 assertTrue(dailyCalendar.toString().indexOf("01:20:01:456 - 14:50:15:002") > 0); 32 } 33 34 public void testStringInvertTimeRange() { 35 DailyCalendar dailyCalendar = new DailyCalendar("TestCal", "1:20", "14:50"); 36 dailyCalendar.setInvertTimeRange(true); 37 assertTrue(dailyCalendar.toString().indexOf("inverted: true") > 0); 38 39 dailyCalendar.setInvertTimeRange(false); 40 assertTrue(dailyCalendar.toString().indexOf("inverted: false") > 0); 41 } 42 43 47 protected Object getTargetObject() { 48 DailyCalendar c = new DailyCalendar("TestCal", "01:20:01:456", "14:50:15:002"); 49 c.setDescription("description"); 50 c.setInvertTimeRange(true); 51 52 return c; 53 } 54 55 59 protected String [] getVersions() { 60 return VERSIONS; 61 } 62 63 67 protected void verifyMatch(Object target, Object deserialized) { 68 DailyCalendar targetCalendar = (DailyCalendar)target; 69 DailyCalendar deserializedCalendar = (DailyCalendar)deserialized; 70 71 assertNotNull(deserializedCalendar); 72 assertEquals(targetCalendar.getDescription(), deserializedCalendar.getDescription()); 73 assertTrue(deserializedCalendar.getInvertTimeRange()); 74 assertNull(deserializedCalendar.getTimeZone()); 75 assertTrue(deserializedCalendar.toString().indexOf("01:20:01:456 - 14:50:15:002") > 0); 76 } 77 } 78 | Popular Tags |