summaryrefslogtreecommitdiffstats
path: root/test/com
diff options
context:
space:
mode:
authorAlex Clayton <alex.clayton@isode.com>2016-02-26 11:19:56 (GMT)
committerAlex Clayton <alex.clayton@isode.com>2016-03-07 10:58:38 (GMT)
commit8fe752626726ca8d058ce437127a37d5d738a5eb (patch)
treee5e6ed4552cdac9c25101bd4f42f6b1a65a31cfb /test/com
parent16fb1d46d48b46627272275ec46b19f68375e778 (diff)
downloadstroke-8fe752626726ca8d058ce437127a37d5d738a5eb.zip
stroke-8fe752626726ca8d058ce437127a37d5d738a5eb.tar.bz2
Add missing TLS and Base classes
Add missing methods and classes in the TLS and Base packages where possible. In the case of TLSContextFactory the methods could not be implemented in java so added a not saying they are not supported in java. Test-information: Unit tests still build and run ok. Change-Id: I9be2035f092875fcdc02644a3c0082739f26949a
Diffstat (limited to 'test/com')
-rw-r--r--test/com/isode/stroke/base/DateTimeTest.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/com/isode/stroke/base/DateTimeTest.java b/test/com/isode/stroke/base/DateTimeTest.java
new file mode 100644
index 0000000..e6fc787
--- /dev/null
+++ b/test/com/isode/stroke/base/DateTimeTest.java
@@ -0,0 +1,56 @@
+/* Copyright (c) 2016, Isode Limited, London, England.
+ * All rights reserved.
+ *
+ * Acquisition and use of this software and related materials for any
+ * purpose requires a written license agreement from Isode Limited,
+ * or a written license from an organisation licensed by Isode Limited
+ * to grant such a license.
+ *
+ */
+package com.isode.stroke.base;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.TimeZone;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * @author ac
+ * @since 16.5
+ *
+ */
+public class DateTimeTest {
+
+ private final SimpleDateFormat isoFormatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
+
+ @Before
+ public void setUp() {
+ isoFormatter.setTimeZone(TimeZone.getTimeZone("UTC"));
+ }
+
+ @Test
+ public void testStringToDateTime_UTC() {
+ Date time = DateTime.stringToDate("1969-07-21T02:56:15Z");
+ assertNotNull(time);
+ assertEquals("1969-07-21T02:56:15", isoFormatter.format(time));
+ }
+
+ @Test
+ public void testStringToDateTime_WithTimezone() {
+ Date time = DateTime.stringToDate("1969-07-20T21:56:15-05:00");
+ assertNotNull(time);
+ assertEquals("1969-07-21T02:56:15", isoFormatter.format(time));
+ }
+
+ @Test
+ public void testDateTimeToString() {
+ Date time = DateTime.stringToDate("1969-07-20T21:56:15-05:00");
+ assertEquals("1969-07-21T02:56:15Z", DateTime.dateToString(time));
+ }
+
+}