Repository: camel
Updated Branches:
  refs/heads/master 104b4258e -> ef2bd37c2


CAMEL-10090: added spock unittest for DateTimeUtils with Ignore


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/ef2bd37c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/ef2bd37c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/ef2bd37c

Branch: refs/heads/master
Commit: ef2bd37c2ccca1bfece2f6dbd4ce66f5c85cb413
Parents: 104b425
Author: Arno Noordover <anoordo...@users.noreply.github.com>
Authored: Tue Aug 2 21:06:57 2016 +0200
Committer: Arno Noordover <anoordo...@users.noreply.github.com>
Committed: Tue Aug 2 21:06:57 2016 +0200

----------------------------------------------------------------------
 .../camel-salesforce-component/pom.xml          | 23 ++++++++
 .../api/utils/DateTimeUtilsTest.groovy          | 58 ++++++++++++++++++++
 2 files changed, 81 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/ef2bd37c/components/camel-salesforce/camel-salesforce-component/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/pom.xml 
b/components/camel-salesforce/camel-salesforce-component/pom.xml
index 3f20a73..29171ec 100644
--- a/components/camel-salesforce/camel-salesforce-component/pom.xml
+++ b/components/camel-salesforce/camel-salesforce-component/pom.xml
@@ -41,6 +41,12 @@
 
   <dependencies>
     <dependency>
+      <groupId>org.spockframework</groupId>
+      <artifactId>spock-core</artifactId>
+      <version>1.0-groovy-2.4</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
       <scope>test</scope>
@@ -148,4 +154,21 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.codehaus.gmavenplus</groupId>
+        <artifactId>gmavenplus-plugin</artifactId>
+        <version>1.4</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>compile</goal>
+              <goal>testCompile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/ef2bd37c/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
----------------------------------------------------------------------
diff --git 
a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
 
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
new file mode 100644
index 0000000..3495d08
--- /dev/null
+++ 
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/api/utils/DateTimeUtilsTest.groovy
@@ -0,0 +1,58 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.salesforce.api.utils
+
+import spock.lang.Ignore
+import spock.lang.Specification
+import spock.lang.Unroll
+
+import java.time.ZoneId
+import java.time.ZonedDateTime
+
+class DateTimeUtilsTest extends Specification {
+    @Unroll
+    @Ignore
+    def "Date #zonedDateTime should render as #result"() {
+        expect:
+        DateTimeUtils.formatDateTime(zonedDateTime) == result
+
+        where:
+        zonedDateTime                                                          
        || result
+        ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 7000000, 
ZoneId.of("UTC+01:00:21")) || "1991-12-10T12:13:14.007+01:00"
+        ZonedDateTime.of(1991, 12, 10, 12, 13, 14, 7000000, ZoneId.of("UTC"))  
        || "1991-12-10T12:13:14.007Z"
+        ZonedDateTime.of(1700, 1, 1, 1, 13, 14, 7000000, 
ZoneId.of("UTC+00:19:21"))    || "1700-01-01T01:13:14.007+00:19"
+        ZonedDateTime.of(1700, 2, 3, 2, 13, 14, 7000000, ZoneId.of("UTC"))     
        || "1700-02-03T02:13:14.007Z"
+    }
+
+    @Unroll
+    @Ignore
+    def "Date #dateAsString should parse to #result"() {
+        expect:
+        DateTimeUtils.parseDateTime(dateAsString) == result
+
+        where:
+        dateAsString                    || result
+        "1991-12-10T12:13:14.007+01:00" || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 7000000, ZoneId.of("+01:00"))
+        "1991-12-10T12:13:14+00:00"     || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
+        "1991-12-10T12:13:14.000+00:00" || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
+        "1991-12-10T12:13:14+0000"      || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
+        "1991-12-10T12:13:14.000+0000"  || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 0, ZoneId.of("Z"))
+        "1991-12-10T12:13:14.007Z"      || ZonedDateTime.of(1991, 12, 10, 12, 
13, 14, 7000000, ZoneId.of("Z"))
+        "1700-01-01T01:13:14.007+00:19" || ZonedDateTime.of(1700, 1, 1, 1, 13, 
14, 7000000, ZoneId.of("+00:19"))
+        "1700-02-03T02:13:14.007Z"      || ZonedDateTime.of(1700, 2, 3, 2, 13, 
14, 7000000, ZoneId.of("Z"))
+    }
+}

Reply via email to