All Downloads are FREE. Search and download functionalities are using the official Maven repository.

at.spardat.xma.test.HelpUriTest Maven / Gradle / Ivy

/*******************************************************************************
 * Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH .
 * 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:
 *     s IT Solutions AT Spardat GmbH - initial API and implementation
 *******************************************************************************/

/*
 * @(#) $Id: HelpUriTest.java 2089 2007-11-28 13:56:13Z s3460 $
 *
 * 
 * 
 * 
 *
 */
package at.spardat.xma.test;

import java.util.Locale;

import at.spardat.xma.page.PageClient;

import junit.framework.Assert;
import junit.framework.TestCase;

public class HelpUriTest extends TestCase {

    public HelpUriTest(String name) {
        super(name);
    }

    public static void main(String[] args) {
        junit.awtui.TestRunner.run(HelpUriTest.class);
    }

    public void testInsertLangInFilename() {
        Locale locale = Locale.ENGLISH;
        Assert.assertEquals("help_en.html",PageClient.insertLangInFilename("help.html",locale));
        Assert.assertEquals("help_en",PageClient.insertLangInFilename("help",locale));
        Assert.assertEquals("_en.html",PageClient.insertLangInFilename(".html",locale));
        Assert.assertEquals("_en.",PageClient.insertLangInFilename(".",locale));
        Assert.assertEquals("_en",PageClient.insertLangInFilename("",locale));
        Assert.assertEquals("._en.",PageClient.insertLangInFilename("..",locale));
        Assert.assertEquals(null,PageClient.insertLangInFilename(null,locale));
        Assert.assertEquals("http://imcref.server.lan.at/xma_samplespar/at/spardat/xma/xma_samplespar/page/Page_en.html",PageClient.insertLangInFilename("http://imcref.server.lan.at/xma_samplespar/at/spardat/xma/xma_samplespar/page/Page.html",locale));
        Assert.assertEquals("http://imcref.server.lan.at/xma_samplespar/at/spardat/xma/xma_samplespar/page/Page_en",PageClient.insertLangInFilename("http://imcref.server.lan.at/xma_samplespar/at/spardat/xma/xma_samplespar/page/Page",locale));
        Assert.assertEquals("http://imcref.server.lan.at/xma_samplespar/at/spardat/xma/xma_samplespar/page.test/Page_en",PageClient.insertLangInFilename("http://imcref.server.lan.at/xma_samplespar/at/spardat/xma/xma_samplespar/page.test/Page",locale));
        Assert.assertEquals("//_en",PageClient.insertLangInFilename("//",locale));
        Assert.assertEquals("help_de.html",PageClient.insertLangInFilename("help.html",new Locale("de","AT")));
    }    
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy