1 package org.starobjects.tested.fitnesse.internal.helpers;
2
3 import java.util.Calendar;
4 import java.util.Date;
5
6 import org.nakedobjects.applib.fixtures.FixtureClock;
7 import org.starobjects.tested.fitnesse.StoryFixture;
8
9 public class SetClock {
10
11 @SuppressWarnings("unused")
12 private final StoryFixture storyFixture;
13
14 public SetClock(final StoryFixture storyFixture) {
15 this.storyFixture = storyFixture;
16 }
17
18 public void setClock(final Date date) {
19 final FixtureClock clock = FixtureClock.initialize();
20 final Calendar calendar = Calendar.getInstance();
21 calendar.setTime(date);
22 clock.setDate(calendar.get(Calendar.YEAR),
23 calendar.get(Calendar.MONTH) + 1, calendar
24 .get(Calendar.DAY_OF_MONTH));
25 clock.setTime(calendar.get(Calendar.HOUR_OF_DAY), calendar
26 .get(Calendar.MINUTE));
27 }
28
29 }