You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2019/08/22 14:47:26 UTC

[jmeter] branch master updated: Try to get rid of differences in the timezone for the tests

This is an automated email from the ASF dual-hosted git repository.

fschumacher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/jmeter.git


The following commit(s) were added to refs/heads/master by this push:
     new 8482a17  Try to get rid of differences in the timezone for the tests
8482a17 is described below

commit 8482a171e5da29fcdf5e8014b32862e6e4898aff
Author: Felix Schumacher <fe...@internetallee.de>
AuthorDate: Thu Aug 22 16:46:48 2019 +0200

    Try to get rid of differences in the timezone for the tests
---
 .../groovy/org/apache/jorphan/util/ConverterSpec.groovy   | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy b/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy
index 66023c6..176add1 100644
--- a/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy
+++ b/src/jorphan/src/test/groovy/org/apache/jorphan/util/ConverterSpec.groovy
@@ -124,7 +124,7 @@ class ConverterSpec extends Specification {
             value                  | expected
             ""                     | new Date()
             new Date(30000)   | new Date(30000)
-            toLocalDateFormat("08/20/2019", DateFormat.SHORT) | new Date(1566252000L * 1000)
+            toLocalDateFormat("08/20/2019", DateFormat.SHORT) | toLocalDate("08/20/2019", DateFormat.SHORT)
     }
 
     def "Convert to Calendar from '#value'"() {
@@ -135,16 +135,21 @@ class ConverterSpec extends Specification {
             value                  | expected
             ""                     | new Date()
             new Date(30000)   | new Date(30000)
-            toLocalDateFormat("08/20/2019", DateFormat.SHORT) | new Date(1566252000L * 1000)
+            toLocalDateFormat("08/20/2019", DateFormat.SHORT) | toLocalDate("08/20/2019", DateFormat.SHORT)
     }
 
     def toLocalDateFormat(String dateString, int format) {
+        def date = toLocalDate(dateString, format)
+        return DateFormat.getDateInstance(format).format(date)
+    }
+
+    def toLocalDate(String dateString, int format) {
         def date = DateFormat
-                .getDateInstance(DateFormat.SHORT, Locale.forLanguageTag("en_US"))
+                .getDateInstance(format, Locale.forLanguageTag("en_US"))
                 .parse(dateString)
-        return DateFormat.getDateInstance(format).format(date)
+        return date
     }
-    
+
     def "line breaks should be replaced in '#source' to '#expected'"() {
         expect:
            Converter.insertLineBreaks(source, "foo") == expected