Example usage for java.util Locale GERMANY

List of usage examples for java.util Locale GERMANY

Introduction

In this page you can find the example usage for java.util Locale GERMANY.

Prototype

Locale GERMANY

To view the source code for java.util Locale GERMANY.

Click Source Link

Document

Useful constant for country.

Usage

From source file:de.perdian.commons.servlet.TestServletUtils.java

@Test
public void testExtractAcceptedLocalesNoHeaderFound() {

    MockHttpServletRequest httpRequest = new MockHttpServletRequest();

    List<Locale> acceptedLocales = ServletUtils.extractAcceptedLocales(httpRequest,
            Arrays.asList(Locale.GERMANY));
    Assert.assertEquals(1, acceptedLocales.size());
    Assert.assertTrue(acceptedLocales.contains(Locale.GERMANY));

}

From source file:net.sf.sze.model.stammdaten.Schueler.java

/**
 * Schreibt die Daten in die Printmap.//ww w.j  av  a 2s. c  om
 * @param printMap die Printmap.
 */
public void toPrintMap(final Map<String, Object> printMap) {
    printMap.put("schueler_name", name);
    printMap.put("schueler_vorname", vorname);
    printMap.put("schueler_geburtsort", geburtsort);
    printMap.put("schueler_nummer", nummer);

    final SimpleDateFormat formatter = new SimpleDateFormat("dd.MM.yyyy", Locale.GERMANY);
    printMap.put("schueler_geburtstag", formatter.format(geburtstag));
    printMap.put("schueler_aufnahmeDatum", aufnahmeDatum == null ? null : formatter.format(aufnahmeDatum));
    printMap.put("schueler_abgangsDatum", abgangsDatum == null ? null : formatter.format(abgangsDatum));
}

From source file:org.jfree.data.time.MillisecondTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///ww w. jav a 2 s  . c  o  m
@Test
public void testGetFirstMillisecondWithCalendar() {
    Millisecond m = new Millisecond(500, 55, 40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766455500L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.time.junit.MinuteTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///from w w  w.ja v  a2s  .c  om
public void testGetFirstMillisecondWithCalendar() {
    Minute m = new Minute(40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766400000L, m.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        m.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:org.jfree.data.time.junit.SecondTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///  www.j ava 2 s .  c o m
public void testGetFirstMillisecondWithCalendar() {
    Second s = new Second(55, 40, 2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955766455000L, s.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        s.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:de.interseroh.report.controller.ReportControllerTest.java

@Test
public void testDateFormFieldWithScript() throws Exception {
    when(securityService.hasUserValidRole(eq("multiselect"))).thenReturn(true);

    String expectedDate = "01.01." + Calendar.getInstance().get(Calendar.YEAR);

    LocaleContextHolder.setLocale(Locale.GERMANY);
    this.mockMvc.perform(get("/reports/multiselect/params?language=DE")).andExpect(status().isOk()) //
            .andExpect(content().string(containsString(expectedDate)));
}

From source file:org.openestate.io.immoxml.ImmoXmlUtils.java

public static BigDecimal parseDecimal(String value) {
    value = StringUtils.trimToNull(value);
    if (value == null)
        return null;
    try {/* ww w .  ja v a 2  s. co  m*/
        return DatatypeConverter.parseDecimal(value);
    } catch (NumberFormatException ex) {
        //LOGGER.warn( "Can't parse value '" + value + "' as decimal!" );
        //LOGGER.warn( "> " + ex.getLocalizedMessage(), ex );
    }
    try {
        return BigDecimal.valueOf(NumberUtils.parseNumber(value, Locale.GERMANY).doubleValue());
    } catch (NumberFormatException ex) {
        //LOGGER.warn( "Can't parse value '" + value + "' as decimal!" );
        //LOGGER.warn( "> " + ex.getLocalizedMessage(), ex );
    }
    throw new IllegalArgumentException("Can't parse decimal value '" + value + "'!");
}

From source file:org.jfree.data.time.HourTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *//*  ww  w  .j  a v  a 2  s  .  co  m*/
@Test
public void testGetFirstMillisecondWithCalendar() {
    Hour h = new Hour(2, 15, 4, 2000);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(955764000000L, h.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        h.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}

From source file:hk.idv.kenson.jrconsole.Console.java

/**
 * /*from   w w  w .  j av a2 s  .c o  m*/
 * @param localeString
 * @return
 */
private static Locale getLocale(String localeString) {
    if ("default".equals(localeString))
        return Locale.getDefault();
    if ("canada".equals(localeString))
        return Locale.CANADA;
    if ("canada_french".equals(localeString))
        return Locale.CANADA_FRENCH;
    if ("china".equals(localeString))
        return Locale.CHINA;
    if ("chinese".equals(localeString))
        return Locale.CHINESE;
    if ("english".equals(localeString))
        return Locale.ENGLISH;
    if ("franch".equals(localeString))
        return Locale.FRANCE;
    if ("german".equals(localeString))
        return Locale.GERMAN;
    if ("germany".equals(localeString))
        return Locale.GERMANY;
    if ("italian".equals(localeString))
        return Locale.ITALIAN;
    if ("italy".equals(localeString))
        return Locale.ITALY;
    if ("japan".equals(localeString))
        return Locale.JAPAN;
    if ("japanese".equals(localeString))
        return Locale.JAPANESE;
    if ("korea".equals(localeString))
        return Locale.KOREA;
    if ("korean".equals(localeString))
        return Locale.KOREAN;
    if ("prc".equals(localeString))
        return Locale.PRC;
    if ("simplified_chinese".equals(localeString))
        return Locale.SIMPLIFIED_CHINESE;
    if ("taiwan".equals(localeString))
        return Locale.TAIWAN;
    if ("traditional_chinese".equals(localeString))
        return Locale.TRADITIONAL_CHINESE;
    if ("uk".equals(localeString))
        return Locale.UK;
    if ("us".equals(localeString))
        return Locale.US;

    String parts[] = localeString.split("_", -1);
    if (parts.length == 1)
        return new Locale(parts[0]);
    else if (parts.length == 2)
        return new Locale(parts[0], parts[1]);
    else
        return new Locale(parts[0], parts[1], parts[2]);
}

From source file:org.jfree.data.time.YearTest.java

/**
 * Some checks for the getFirstMillisecond(TimeZone) method.
 *///from  w  ww.ja va2  s.co m
@Test
public void testGetFirstMillisecondWithCalendar() {
    Year y = new Year(2001);
    GregorianCalendar calendar = new GregorianCalendar(Locale.GERMANY);
    calendar.setTimeZone(TimeZone.getTimeZone("Europe/Frankfurt"));
    assertEquals(978307200000L, y.getFirstMillisecond(calendar));

    // try null calendar
    boolean pass = false;
    try {
        y.getFirstMillisecond((Calendar) null);
    } catch (NullPointerException e) {
        pass = true;
    }
    assertTrue(pass);
}