Skip to content

Commit dee6cd6

Browse files
eviltestereviltester
authored andcommitted
set the start of week
set the start of week to allow week of month calculation to work on different configs
1 parent 9bcaf69 commit dee6cd6

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

source/src/test/java/com/javafortesters/chap017_datestimes/exercises/DateTimeExercisesTest.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public void useOtherCalendarConstants(){
7676
public void experimentWithCalendarConstants(){
7777
Calendar cal = Calendar.getInstance();
7878
cal.set(2013, Calendar.DECEMBER, 15, 23,39, 54);
79+
// week of month depends on first day of week
80+
// some places use SUNDAY as first day
81+
// set to MONDAY for our calculation
82+
cal.setFirstDayOfWeek(Calendar.MONDAY);
7983

8084
assertThat(cal.get(Calendar.DAY_OF_WEEK), is(1));
8185
assertThat(cal.get(Calendar.DAY_OF_WEEK), is(Calendar.SUNDAY));

0 commit comments

Comments
 (0)