////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2015 the original author or authors.
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
////////////////////////////////////////////////////////////////////////////////

package com.puppycrawl.tools.checkstyle.api;

import nl.jqno.equalsverifier.EqualsVerifier;
import org.junit.After;
import org.junit.Test;

import java.util.Locale;

import static org.junit.Assert.assertEquals;

public class LocalizedMessageTest {

    private static final Locale DEFAULT_LOCALE = Locale.getDefault();

    @Test
    public void testEqualsAndHashCode() {
        EqualsVerifier.forClass(LocalizedMessage.class).usingGetClass().verify();
    }

    @Test
    public void testEnforceEnglishLanguageBySettingUnitedStatesLocale() {
        Locale.setDefault(Locale.FRENCH);
        LocalizedMessage.setLocale(Locale.US);
        LocalizedMessage localizedMessage = createSampleLocalizedMessage();

        assertEquals("Empty statement.", localizedMessage.getMessage());
    }

    private static LocalizedMessage createSampleLocalizedMessage() {
        return new LocalizedMessage(0, "com.puppycrawl.tools.checkstyle.checks.coding.messages",
                "empty.statement", new Object[]{}, "", LocalizedMessage.class, null);
    }

    @After
    public void tearDown() {
        Locale.setDefault(DEFAULT_LOCALE);
        LocalizedMessage.clearCache();
        LocalizedMessage.setLocale(DEFAULT_LOCALE);
    }
}

@@ -1521,148 +1521,991 @@
 test
-EnforceEnglishLanguageBySettingUnitedStatesLocale() %7B%0A        Locale.setDefault(Locale.FRENCH);%0A        LocalizedMessage.setLocale(Locale.US
+MessageInEnglish() %7B%0A        LocalizedMessage localizedMessage = createSampleLocalizedMessage();%0A        LocalizedMessage.setLocale(Locale.ENGLISH);%0A%0A        assertEquals(%22Empty statement.%22, localizedMessage.getMessage());%0A    %7D%0A%0A    @Test%0A    public void testMessageInFrench() %7B%0A        LocalizedMessage localizedMessage = createSampleLocalizedMessage();%0A        LocalizedMessage.setLocale(Locale.FRENCH);%0A%0A        assertEquals(%22Instruction vide.%22, localizedMessage.getMessage());%0A    %7D%0A%0A    @Test%0A    public void testEnforceEnglishLanguageBySettingUnitedStatesLocale() %7B%0A        Locale.setDefault(Locale.FRENCH);%0A        LocalizedMessage.setLocale(Locale.US);%0A        LocalizedMessage localizedMessage = createSampleLocalizedMessage();%0A%0A        assertEquals(%22Empty statement.%22, localizedMessage.getMessage());%0A    %7D%0A%0A    @Test%0A    public void testEnforceEnglishLanguageBySettingRootLocale() %7B%0A        Locale.setDefault(Locale.FRENCH);%0A        LocalizedMessage.setLocale(Locale.ROOT
 );%0A 

Add additional locale tests to LocalizedMessage. #152