/**
 * Copyright 2011, Aiki IT, FotoRenamer
 * <p/>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * <p/>
 * http://www.apache.org/licenses/LICENSE-2.0
 * <p/>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package de.aikiit.fotorenamer.util;

import org.junit.Test;

import java.util.Locale;

import static de.aikiit.fotorenamer.util.LocalizationHelper.*;

import static org.junit.Assert.assertEquals;

/**
 * Testing resource bundling.
 *
 * @author hirsch
 * @version 23.08.11
 */
public class LocalizationHelperTest {

    /**
     * Retrieve a plain i18n-value.
     */
    @Test
    public final void checkValueRetrievingFromBundle() {
        assertEquals("Fortschritt", getBundleString("fotorenamer.ui.progress"));
    }

    /**
     * Retrieve a i18n-value with parameters set.
     */
    @Test
    public final void checkParametrizedValueExtraction() {
        assertEquals("Erfolg und dann folgt noch die 7", getParameterizedBundleString("fotorenamer.test.param",
                "Erfolg", 7));
        // ignore warning, we want to test what happens here! An empty String or null changes the output.
        assertEquals("{0} und dann folgt noch die {1}", getParameterizedBundleString("fotorenamer.test.param",
                new Object[]{}));
    }

    @Test
    public final void fallbackLocale() {
        // WHEN: reset system properties
        System.setProperty("user.language", "");
        System.setProperty("user.country", "");
        setLocale();

        assertEquals(Locale.GERMANY, getLocale());
        assertEquals("de", getLanguage());
    }

    @Test
    public final void setLocaleViaSystemProperties() {
        // WHEN: reset system properties
        final String french = "fr";
        System.setProperty("user.language", french);
        System.setProperty("user.country", "CA");
        setLocale();

        assertEquals(Locale.CANADA_FRENCH, getLocale());
        assertEquals(french, getLanguage());
    }

    @Test
    public final void umlautEncodingWorksCorrectly() {
        assertEquals("ßäü", getBundleString("fotorenamer.test.umlauts"));
    }

    @Test
    public final void unknownKey() {
        String unknown = "abcde.unknown";
        assertEquals(unknown, getBundleString(unknown));
    }
}

@@ -887,23 +887,16 @@
 .11%0A */%0A
-public 
 class Lo
@@ -918,16 +918,16 @@
 rTest %7B%0A
+
 %0A    /**
@@ -981,37 +981,24 @@
   @Test%0A    
-public final 
 void checkVa
@@ -1189,37 +1189,24 @@
   @Test%0A    
-public final 
 void checkPa
@@ -1646,37 +1646,24 @@
   @Test%0A    
-public final 
 void fallbac
@@ -1945,37 +1945,24 @@
   @Test%0A    
-public final 
 void setLoca
@@ -2308,37 +2308,24 @@
   @Test%0A    
-public final 
 void umlautE
@@ -2445,25 +2445,12 @@
 est%0A
+
     
-public final 
 void

Fix javadoc