Skip to content
This repository

Fix TimeZone issue in testcase #45

Merged
merged 1 commit into from almost 2 years ago

2 participants

Nobuhiro Sue Rob Fletcher
Nobuhiro Sue

In non-UTC locale (like JST in Japan) java.util.Date holds non-UTC based value, so some test cases go fail.
I suggest to use Calendar class.

Rob Fletcher robfletcher merged commit 0193831 into from
Rob Fletcher robfletcher closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Nov 07, 2011
Nobuhiro Sue Fix TimeZone issue in testcase c0e4aa8
This page is out of date. Refresh to see the latest.
5  src/test/groovy/betamax/tape/ReadTapeFromYamlSpec.groovy
@@ -26,11 +26,14 @@ interactions:
26 26
 """
27 27
 		when:
28 28
 		def tape = YamlTape.readFrom(new StringReader(yaml))
  29
+		def utc = Calendar.getInstance(TimeZone.getTimeZone('UTC'))
  30
+		utc.set(2011, 7, 23, 22, 41, 40)
  31
+		utc.set(Calendar.MILLISECOND, 0)
29 32
 
30 33
 		then:
31 34
 		tape.name == "single_interaction_tape"
32 35
 		tape.interactions.size() == 1
33  
-		tape.interactions[0].recorded == new Date(111, 7, 23, 23, 41, 40)
  36
+		tape.interactions[0].recorded == utc.time
34 37
 		tape.interactions[0].request.method == "GET"
35 38
 		tape.interactions[0].request.uri == "http://icanhascheezburger.com/".toURI()
36 39
 		tape.interactions[0].response.status == HTTP_OK
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.