1 package org.jbpm.calendar; 2 3 import java.text.*; 4 5 import junit.framework.*; 6 7 public class DayPartTest extends TestCase { 8 9 public void testDayPartParsing() { 10 DateFormat dateFormat = new SimpleDateFormat("HH:mm"); 11 DayPart dayPart = new DayPart("9:00-12:15", dateFormat, null, 0); 12 assertEquals(9, dayPart.fromHour); 13 assertEquals(0, dayPart.fromMinute); 14 assertEquals(12, dayPart.toHour); 15 assertEquals(15, dayPart.toMinute); 16 } 17 18 public void testDayPartWithSpacesParsing() { 19 DateFormat dateFormat = new SimpleDateFormat("HH:mm"); 20 DayPart dayPart = new DayPart(" 9:00 - 12:15 ", dateFormat, null, 0); 21 assertEquals(9, dayPart.fromHour); 22 assertEquals(0, dayPart.fromMinute); 23 assertEquals(12, dayPart.toHour); 24 assertEquals(15, dayPart.toMinute); 25 } 26 27 public void testDayPartAmPmParsing() { 28 DateFormat dateFormat = new SimpleDateFormat("hh'h'mma"); 29 DayPart dayPart = new DayPart("9h00am-12h15pm", dateFormat, null, 0); 30 assertEquals(9, dayPart.fromHour); 31 assertEquals(0, dayPart.fromMinute); 32 assertEquals(12, dayPart.toHour); 33 assertEquals(15, dayPart.toMinute); 34 } 35 36 } 37 | Popular Tags |