1 package org.jbpm.calendar; 2 3 import java.text.*; 4 5 import junit.framework.*; 6 7 public class DayTest extends TestCase { 8 9 public void testDaySingleDayPartParsing() { 10 DateFormat dateFormat = new SimpleDateFormat("HH:mm"); 11 Day day = new Day("9:00-12:15", dateFormat, null); 12 assertEquals(1, day.dayParts.length); 13 DayPart dayPart = day.dayParts[0]; 14 assertEquals(9, dayPart.fromHour); 15 assertEquals(0, dayPart.fromMinute); 16 assertEquals(12, dayPart.toHour); 17 assertEquals(15, dayPart.toMinute); 18 } 19 20 public void testDayMultipleDayPartsParsing() { 21 DateFormat dateFormat = new SimpleDateFormat("HH:mm"); 22 Day day = new Day("9:00-12:15 & 13:00-17:00", dateFormat, null); 23 assertEquals(2, day.dayParts.length); 24 DayPart dayPart = day.dayParts[1]; 25 assertEquals(13, dayPart.fromHour); 26 assertEquals(0, dayPart.fromMinute); 27 assertEquals(17, dayPart.toHour); 28 assertEquals(0, dayPart.toMinute); 29 } 30 31 public void testEmptyDayParsing() { 32 DateFormat dateFormat = new SimpleDateFormat("HH:mm"); 33 Day day = new Day("", dateFormat, null); 34 assertEquals(0, day.dayParts.length); 35 } 36 } 37 | Popular Tags |