Skip to content

Instantly share code, notes, and snippets.

@unclejamal
Created September 18, 2013 20:42
Show Gist options
  • Save unclejamal/6615367 to your computer and use it in GitHub Desktop.
Save unclejamal/6615367 to your computer and use it in GitHub Desktop.
@Test
public void saysTheCurrentTime() throws Exception {
givenTheCurrentTimeIs("20:15");
whenAUserChecksTheTime();
thenTheUserSees("It's currently 20:15!");
}
private void givenTheCurrentTimeIs(String currentTime) throws ParseException {
Date currentTimeAsDate = new SimpleDateFormat("HH:mm").parse(currentTime);
clock.setNow(currentTimeAsDate);
}
private void whenAUserChecksTheTime() {
actualApplicationTime = timeExpertUser.checkCurrentTime();
}
private void thenTheUserSees(String expectedApplicationTime) {
assertEquals(expectedApplicationTime, actualApplicationTime);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment