You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by mj...@apache.org on 2020/10/26 19:59:24 UTC

[guacamole-client] 03/05: GUACAMOLE-760: Add JUnit tests for TimeZone getAvailableIDs.

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

mjumper pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/guacamole-client.git

commit 6d7456ec3130ecfa4d563a09c3353aab025523d8
Author: Virtually Nick <vn...@apache.org>
AuthorDate: Mon Oct 26 11:09:49 2020 -0400

    GUACAMOLE-760: Add JUnit tests for TimeZone getAvailableIDs.
---
 .../properties/TimeZoneGuacamolePropertyTest.java  | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/guacamole-ext/src/test/java/org/apache/guacamole/properties/TimeZoneGuacamolePropertyTest.java b/guacamole-ext/src/test/java/org/apache/guacamole/properties/TimeZoneGuacamolePropertyTest.java
index 48535a1..4c4ced1 100644
--- a/guacamole-ext/src/test/java/org/apache/guacamole/properties/TimeZoneGuacamolePropertyTest.java
+++ b/guacamole-ext/src/test/java/org/apache/guacamole/properties/TimeZoneGuacamolePropertyTest.java
@@ -21,6 +21,7 @@ package org.apache.guacamole.properties;
 
 import java.util.Arrays;
 import java.util.List;
+import java.util.TimeZone;
 import org.apache.guacamole.GuacamoleException;
 import static org.junit.Assert.*;
 import org.junit.Test;
@@ -104,6 +105,12 @@ public class TimeZoneGuacamolePropertyTest {
     );
     
     /**
+     * The list of all available timezones that are known to the TimeZone class.
+     */
+    private static final List<String> TZ_AVAIL_IDS =
+            Arrays.asList(TimeZone.getAvailableIDs());
+    
+    /**
      * An example TimeZoneGuacamoleProperty for testing how various possible
      * TimeZone values will be parsed.
      */
@@ -218,6 +225,23 @@ public class TimeZoneGuacamolePropertyTest {
     }
     
     /**
+     * Tests the list of available identifiers provided by the TimeZone class
+     * to make sure that all identifiers provided pass through successfully and
+     * do not yield unexpected results.
+     * 
+     * @throws GuacamoleException 
+     *     If the test fails unexpectedly because the timezone is not recognized
+     *     and is converted to GMT.
+     */
+    public void availTzCheck() throws GuacamoleException {
+        for (String tzStr : TZ_AVAIL_IDS) {
+            String tzId = WHERE_IN_WORLD.parseValue(tzStr).getID();
+            assertNotNull(tzId);
+            assertTrue(tzId.equals(tzStr));
+        }
+    }
+    
+    /**
      * Tests parse of null input values to make sure the resuling parsed value
      * is also null.
      *