Search in sources :

Example 16 with Locale

use of java.util.Locale in project checkstyle by checkstyle.

the class SuppressWarningsFilterTest method createChecker.

@Override
public Checker createChecker(Configuration checkConfig) throws Exception {
    final DefaultConfiguration checkerConfig = new DefaultConfiguration("configuration");
    final DefaultConfiguration checksConfig = createCheckConfig(TreeWalker.class);
    final DefaultConfiguration holderConfig = createCheckConfig(SuppressWarningsHolder.class);
    holderConfig.addAttribute("aliasList", "com.puppycrawl.tools.checkstyle.checks.sizes." + "ParameterNumberCheck=paramnum");
    checksConfig.addChild(holderConfig);
    final DefaultConfiguration memberNameCheckConfig = createCheckConfig(MemberNameCheck.class);
    memberNameCheckConfig.addAttribute("id", "ignore");
    checksConfig.addChild(memberNameCheckConfig);
    final DefaultConfiguration constantNameCheckConfig = createCheckConfig(ConstantNameCheck.class);
    constantNameCheckConfig.addAttribute("id", "");
    checksConfig.addChild(constantNameCheckConfig);
    checksConfig.addChild(createCheckConfig(ParameterNumberCheck.class));
    checksConfig.addChild(createCheckConfig(IllegalCatchCheck.class));
    final DefaultConfiguration uncommentedMainCheckConfig = createCheckConfig(UncommentedMainCheck.class);
    uncommentedMainCheckConfig.addAttribute("id", "ignore");
    checksConfig.addChild(uncommentedMainCheckConfig);
    checksConfig.addChild(createCheckConfig(JavadocTypeCheck.class));
    checkerConfig.addChild(checksConfig);
    if (checkConfig != null) {
        checkerConfig.addChild(checkConfig);
    }
    final Checker checker = new Checker();
    final Locale locale = Locale.ROOT;
    checker.setLocaleCountry(locale.getCountry());
    checker.setLocaleLanguage(locale.getLanguage());
    checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader());
    checker.configure(checkerConfig);
    checker.addListener(new BriefUtLogger(stream));
    return checker;
}
Also used : Locale(java.util.Locale) JavadocTypeCheck(com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocTypeCheck) Checker(com.puppycrawl.tools.checkstyle.Checker) ParameterNumberCheck(com.puppycrawl.tools.checkstyle.checks.sizes.ParameterNumberCheck) DefaultConfiguration(com.puppycrawl.tools.checkstyle.DefaultConfiguration) BriefUtLogger(com.puppycrawl.tools.checkstyle.BriefUtLogger) IllegalCatchCheck(com.puppycrawl.tools.checkstyle.checks.coding.IllegalCatchCheck)

Example 17 with Locale

use of java.util.Locale in project philm by chrisbanes.

the class AndroidCountryProvider method getTwoLetterCountryCodeFromLocale.

private String getTwoLetterCountryCodeFromLocale() {
    final Locale locale = Locale.getDefault();
    final String countryCode = locale.getCountry();
    if (!TextUtils.isEmpty(countryCode)) {
        return countryCode;
    }
    return null;
}
Also used : Locale(java.util.Locale)

Example 18 with Locale

use of java.util.Locale in project philm by chrisbanes.

the class AndroidCountryProvider method getTwoLetterLanguageCode.

@Override
public String getTwoLetterLanguageCode() {
    if (mLanguageCode == null) {
        final Locale locale = Locale.getDefault();
        mLanguageCode = locale.getLanguage();
    }
    return mLanguageCode;
}
Also used : Locale(java.util.Locale)

Example 19 with Locale

use of java.util.Locale in project checkstyle by checkstyle.

the class SeverityLevelTest method testMixedCaseSpacesWithDifferentLocales.

@Test
public void testMixedCaseSpacesWithDifferentLocales() {
    final Locale[] differentLocales = { new Locale("TR", "tr") };
    final Locale defaultLocale = Locale.getDefault();
    try {
        for (Locale differentLocale : differentLocales) {
            Locale.setDefault(differentLocale);
            testMixedCaseSpaces();
        }
    } finally {
        Locale.setDefault(defaultLocale);
    }
}
Also used : Locale(java.util.Locale) Test(org.junit.Test)

Example 20 with Locale

use of java.util.Locale in project GCViewer by chewiebug.

the class SimpleGcWriterTest method exportLocaleSv.

@Test
public void exportLocaleSv() throws Exception {
    Locale.setDefault(new Locale("sv", "se"));
    try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
        SimpleGcWriter writer = new SimpleGcWriter(outputStream)) {
        writer.write(gcModel);
        String[] lines = outputStream.toString().split(System.getProperty("line.separator"));
        assertEquals("line count", 2, lines.length);
        String[] firstLine = lines[0].split(" ");
        assertEquals("number of parts in line 1", 3, firstLine.length);
        assertEquals("timestamp", "0.677000", firstLine[1]);
    }
}
Also used : Locale(java.util.Locale) ByteArrayOutputStream(java.io.ByteArrayOutputStream) SimpleGcWriter(com.tagtraum.perf.gcviewer.exp.impl.SimpleGcWriter) Test(org.junit.Test)

Aggregations

Locale (java.util.Locale)2214 Test (org.junit.Test)262 ArrayList (java.util.ArrayList)179 HashMap (java.util.HashMap)108 ResourceBundle (java.util.ResourceBundle)83 SimpleDateFormat (java.text.SimpleDateFormat)78 Date (java.util.Date)77 MissingResourceException (java.util.MissingResourceException)68 IOException (java.io.IOException)67 TimeZone (java.util.TimeZone)63 File (java.io.File)50 Map (java.util.Map)49 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)49 Calendar (java.util.Calendar)46 Configuration (android.content.res.Configuration)41 LocaleList (android.os.LocaleList)39 HashSet (java.util.HashSet)39 StudyBean (org.akaza.openclinica.bean.managestudy.StudyBean)39 HttpSession (javax.servlet.http.HttpSession)38 Resources (android.content.res.Resources)37