Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.tests')
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaUtilTest.java38
2 files changed, 40 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java
index 23ab85a31..892e04fc0 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/AllBugzillaHeadlessStandaloneTests.java
@@ -26,6 +26,7 @@ import org.eclipse.mylyn.bugzilla.tests.core.BugzillaFlagsTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaRepositoryConnectorConfigurationTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaRepositoryConnectorStandaloneTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaTaskCompletionTest;
+import org.eclipse.mylyn.bugzilla.tests.core.BugzillaUtilTest;
import org.eclipse.mylyn.bugzilla.tests.core.BugzillaVersionTest;
import org.eclipse.mylyn.bugzilla.tests.core.RepositoryConfigurationTest;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
@@ -74,6 +75,7 @@ public class AllBugzillaHeadlessStandaloneTests {
fixture.add(BugzillaRepositoryConnectorStandaloneTest.class);
fixture.add(BugzillaRepositoryConnectorConfigurationTest.class);
fixture.add(BugzillaClientTest.class);
+ fixture.add(BugzillaUtilTest.class);
// Only run these tests on > 3.2 repositories
if (!fixture.getBugzillaVersion().isSmallerOrEquals(BugzillaVersion.BUGZILLA_3_2)) {
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaUtilTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaUtilTest.java
new file mode 100644
index 000000000..44f4f809d
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/core/BugzillaUtilTest.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.tests.core;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaUtil;
+import org.junit.Test;
+
+public class BugzillaUtilTest extends TestCase {
+
+ @Test
+ public void testValidTimezoneRemove() throws CoreException {
+ assertEquals("2013-10-21 18:50:29", BugzillaUtil.removeTimezone("2013-10-21 18:50:29 +0000"));
+ assertEquals("2013-10-21 18:50:29", BugzillaUtil.removeTimezone("2013-10-21 18:50:29 CEST"));
+ assertEquals("2013-10-21 18:50:29", BugzillaUtil.removeTimezone("2013-10-21 18:50:29 GMT+02:00"));
+ }
+
+ @Test
+ public void testInvalidTimezoneRemove() {
+ try {
+ BugzillaUtil.removeTimezone("2013-10-21T18:50:29");
+ fail("Expected CoreException");
+ } catch (CoreException e) {
+ assertEquals("2013-10-21T18:50:29 is not a valid time", e.getMessage());
+ }
+ }
+}

Back to the top