From e02c53bf7d79d204767b05d92bb9e5958a94b04e Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Fri, 19 Feb 2016 10:01:21 +0100 Subject: [PATCH] OO-1879: save the unit test for the confluence helper --- .../services/help/ConfluenceHelper.java | 2 +- .../services/help/ConfluenceHelperTest.java | 53 +++++++++++++++++++ .../help/spi/ConfluenceLinkSPITest.java | 22 -------- .../java/org/olat/test/AllTestsJunit4.java | 1 + 4 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 src/test/java/org/olat/core/commons/services/help/ConfluenceHelperTest.java diff --git a/src/main/java/org/olat/core/commons/services/help/ConfluenceHelper.java b/src/main/java/org/olat/core/commons/services/help/ConfluenceHelper.java index 015e22a22ba..93bfc07b303 100644 --- a/src/main/java/org/olat/core/commons/services/help/ConfluenceHelper.java +++ b/src/main/java/org/olat/core/commons/services/help/ConfluenceHelper.java @@ -118,7 +118,7 @@ public class ConfluenceHelper { * @param locale * @return */ - private static final String generateSpace(String version, Locale locale) { + protected static final String generateSpace(String version, Locale locale) { StringBuilder sb = new StringBuilder(); sb.append("/OO"); diff --git a/src/test/java/org/olat/core/commons/services/help/ConfluenceHelperTest.java b/src/test/java/org/olat/core/commons/services/help/ConfluenceHelperTest.java new file mode 100644 index 00000000000..cd53e477603 --- /dev/null +++ b/src/test/java/org/olat/core/commons/services/help/ConfluenceHelperTest.java @@ -0,0 +1,53 @@ +/** + * <a href="http://www.openolat.org"> + * OpenOLAT - Online Learning and Training</a><br> + * <p> + * Licensed under the Apache License, Version 2.0 (the "License"); <br> + * you may not use this file except in compliance with the License.<br> + * You may obtain a copy of the License at the + * <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache homepage</a> + * <p> + * Unless required by applicable law or agreed to in writing,<br> + * software distributed under the License is distributed on an "AS IS" BASIS, <br> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. <br> + * See the License for the specific language governing permissions and <br> + * limitations under the License. + * <p> + * Initial code contributed and copyrighted by<br> + * frentix GmbH, http://www.frentix.com + * <p> + */ +package org.olat.core.commons.services.help; + +import java.util.Locale; + +import org.junit.Assert; +import org.junit.Test; + +/** + * + * Initial date: 07.01.2015<br> + * @author srosse, stephane.rosse@frentix.com, http://www.frentix.com + * + */ +public class ConfluenceHelperTest { + + @Test + public void getURL_confluence() { + String url1 = ConfluenceHelper.generateSpace("10.1.1", Locale.GERMAN); + Assert.assertNotNull(url1); + Assert.assertTrue(url1.startsWith("/OO101DE/")); + + String url2 = ConfluenceHelper.generateSpace("10.1", Locale.ENGLISH); + Assert.assertNotNull(url2); + Assert.assertTrue(url2.startsWith("/OO101EN/")); + + String url3 = ConfluenceHelper.generateSpace("10.1a", Locale.ENGLISH); + Assert.assertNotNull(url3); + Assert.assertTrue(url3.startsWith("/OO101EN/")); + + String url4 = ConfluenceHelper.generateSpace("11a", Locale.ENGLISH); + Assert.assertNotNull(url4); + Assert.assertTrue(url4.startsWith("/OO110EN/")); + } +} diff --git a/src/test/java/org/olat/core/commons/services/help/spi/ConfluenceLinkSPITest.java b/src/test/java/org/olat/core/commons/services/help/spi/ConfluenceLinkSPITest.java index 06214d3a619..18789827fdc 100644 --- a/src/test/java/org/olat/core/commons/services/help/spi/ConfluenceLinkSPITest.java +++ b/src/test/java/org/olat/core/commons/services/help/spi/ConfluenceLinkSPITest.java @@ -38,28 +38,6 @@ public class ConfluenceLinkSPITest { private static final OLog log = Tracing.createLoggerFor(ConfluenceLinkSPITest.class); - /* - @Test - public void getURL_confluence() { - ConfluenceLinkSPI linkSPI = new ConfluenceLinkSPI(); - - String url1 = ConfluenceHelper.generateSpace("10.1.1", Locale.GERMAN); - Assert.assertNotNull(url1); - Assert.assertTrue(url1.startsWith("/OO101DE/")); - - String url2 = ConfluenceHelper.generateSpace("10.1", Locale.ENGLISH); - Assert.assertNotNull(url2); - Assert.assertTrue(url2.startsWith("/OO101EN/")); - - String url3 = ConfluenceHelper.generateSpace("10.1a", Locale.ENGLISH); - Assert.assertNotNull(url3); - Assert.assertTrue(url3.startsWith("/OO101EN/")); - - String url4 = ConfluenceHelper.generateSpace("11a", Locale.ENGLISH); - Assert.assertNotNull(url4); - Assert.assertTrue(url4.startsWith("/OO110EN/")); - }*/ - @Test public void getUrl() { // init settings to set version, required by ConfluenceLinkSPI diff --git a/src/test/java/org/olat/test/AllTestsJunit4.java b/src/test/java/org/olat/test/AllTestsJunit4.java index 4d10071147c..dec99017c5a 100644 --- a/src/test/java/org/olat/test/AllTestsJunit4.java +++ b/src/test/java/org/olat/test/AllTestsJunit4.java @@ -85,6 +85,7 @@ import org.junit.runners.Suite; org.olat.commons.coordinate.cluster.jms.JMSTest.class, org.olat.commons.coordinate.cluster.lock.LockTest.class, org.olat.commons.coordinate.CoordinatorTest.class, + org.olat.core.commons.services.help.ConfluenceHelperTest.class, org.olat.core.commons.services.help.spi.ConfluenceLinkSPITest.class, org.olat.core.commons.services.webdav.WebDAVCommandsTest.class, org.olat.core.commons.services.webdav.manager.DigestAuthenticationTest.class, -- GitLab