Java Code Examples for java.util.Locale#ITALY

The following examples show how to use java.util.Locale#ITALY . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: j2objc   File: GregorianCalendarTest.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * java.util.GregorianCalendar#GregorianCalendar(java.util.TimeZone,
 *java.util.Locale)
 */
public void test_ConstructorLjava_util_TimeZoneLjava_util_Locale() {
    // Test for method java.util.GregorianCalendar(java.util.TimeZone,
    // java.util.Locale)
    Date date = new Date(2008, 1, 1);
    TimeZone.getDefault();
    GregorianCalendar gc1 = new GregorianCalendar(AMERICA_NEW_YORK, Locale.JAPAN);
    gc1.setTime(date);
    GregorianCalendar gc2 = new GregorianCalendar(AMERICA_NEW_YORK, Locale.JAPAN);
    gc2.setTime(date);
    GregorianCalendar gc3 = new GregorianCalendar(AMERICA_CHICAGO, Locale.ITALY);
    gc3.setTime(date);
    // Chicago is 1 hour before New York, add 1 to the Chicago time and convert to 0-12 value
    assertEquals("Incorrect calendar returned",
            gc1.get(Calendar.HOUR), ((gc3.get(Calendar.HOUR) + 1) % 12));
    assertTrue("Locales not created correctly", gc1.equals(gc2)
            && !gc1.equals(gc3));
}
 
Example 2
Source Project: birt   File: DateFormatterTest.java    License: Eclipse Public License 1.0 6 votes vote down vote up
@Test
   public void testDateFormatLocale( )
{
	Locale locale = new Locale( "en", "us" );
	DateFormatter sample = new DateFormatter( ULocale.forLocale(locale) );
	Locale locDef = Locale.getDefault( );
	Calendar dateCal = Calendar.getInstance( locDef );
	dateCal.set( 1998, 8, 13, 20, 1, 44 );
	Date date = dateCal.getTime( );
	//assertEquals(sampleJava.format(date), sample.format(date));
	locale = Locale.ITALY;
	sample = new DateFormatter( ULocale.forLocale(locale) );
	SimpleDateFormat sampleJava = new SimpleDateFormat( "MM/dd/yy KK:mm aa", locale );
	//assertEquals(sampleJava.format(date), sample.format(date));
	sample.applyPattern( "MM/dd/yy KK:mm aa" );
	assertEquals( "09/13/98 08:01 PM", sample.format( date ) );
	sample = new DateFormatter( "Long Date", ULocale.forLocale(locale) );
	assertEquals( "13 settembre 1998", sample.format( date ) );
	assertTrue( true );

}
 
Example 3
Source Project: android   File: ExampleUnitTest.java    License: MIT License 5 votes vote down vote up
@Test
public void testStringLocale() throws Exception {
    Locale[] locales = new Locale[]{
            Locale.CANADA,
            Locale.CANADA_FRENCH,
            Locale.CHINESE,
            Locale.ENGLISH,
            Locale.FRANCE,
            Locale.GERMAN,
            Locale.GERMANY,
            Locale.ITALIAN,
            Locale.ITALY,
            Locale.JAPAN,
            Locale.JAPANESE,
            Locale.KOREA,
            Locale.KOREAN,
            Locale.PRC,
            Locale.ROOT,
            Locale.SIMPLIFIED_CHINESE,
            Locale.TAIWAN,
            Locale.TRADITIONAL_CHINESE,
            Locale.UK,
            Locale.US
    };

    String weightString = null;
    for (Locale locale : locales) {
        try {
            weightString = formatFloatWithOneDot(locale, 55.4f);
            float weight = Float.parseFloat(weightString);
        } catch (NumberFormatException e) {
            System.out.println(locale + ">>>>>" + weightString + ">>>>>>>>>> error");
            continue;
        }
        System.out.println(locale + ">>>>>" + weightString);
    }
}
 
Example 4
@Test
public void shouldPlainTextFormatLocale() throws Exception {
    //Arrange
    Locale locale = Locale.ITALY;

    //Act
    String givenFormattedText = EmailFieldFormat.plainText(locale);

    //Assert
    assertions.assertThat(givenFormattedText)
            .isNotNull()
            .isNotEmpty()
            .isEqualTo("it_IT");
}
 
Example 5
Source Project: kripton   File: TestRuntime70All.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Test run.
 *
 * @throws Exception the exception
 */
@Test
public void testRun() throws Exception {
	Assert.assertNotNull(new Bean70AllBindMap());

	Bean70All bean = new Bean70All();

	bean.valueBigDecimal = BigDecimal.valueOf(11.0);
	bean.valueBigInteger = BigInteger.valueOf(10);
	bean.valueEnum = BeanEnum.VALUE_2;
	bean.valueCalendar = Calendar.getInstance();
	bean.valueCurrency = Currency.getInstance(Locale.ITALY);
	bean.valueDate = new Date();
	bean.valueLocale = Locale.ITALY;
	bean.valueTime = new Time(0);
	bean.valueTimeZone = TimeZone.getDefault();
	bean.valueUrl = new URL("http://github.com");
	bean.id = 25;
	bean.valueBean = new Bean70All();
	bean.valueBean.id = 45;
	bean.valueBoolType = true;
	bean.valueBool = true;
	bean.valueByteType = 4;
	bean.valueByte = 8;
	bean.valueShortType = 25;
	bean.valueShort = 25;
	bean.valueCharType = 'a';
	bean.valueChar = 'a';
	bean.valueIntType = 12;
	bean.valueInt = 12;
	bean.valueLongType = 24;
	bean.valueLong = 24L;
	bean.valueFloatType = 24f;
	bean.valueFloat = 24f;
	bean.valueDoubleType = 24.0;
	bean.valueDouble = 24.0;
	bean.valueString = "ciao";

	check(bean);
}
 
Example 6
Source Project: kripton   File: TestRuntime80All.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates the bean.
 *
 * @return the bean 80
 * @throws MalformedURLException the malformed URL exception
 */
public Bean80 createBean() throws MalformedURLException
{
	Bean80 bean = new Bean80();

	bean.valueBigDecimal = BigDecimal.valueOf(11.0);
	bean.valueBigInteger = BigInteger.valueOf(10);
	bean.valueEnum = BeanEnum.VALUE_2;
	bean.valueCalendar = Calendar.getInstance();
	bean.valueCurrency = Currency.getInstance(Locale.ITALY);
	bean.valueDate = new Date();
	bean.valueLocale = Locale.ITALY;
	bean.valueTime = new Time(0);
	bean.valueTimeZone = TimeZone.getDefault();
	bean.valueUrl = new URL("http://github.com");
	bean.id = 25;
	bean.valueBean = new Bean80();
	bean.valueBean.id = 45;
	bean.valueBoolType = true;
	bean.valueBool = true;
	bean.valueByteType = 4;
	bean.valueByte = 8;
	bean.valueShortType = 25;
	bean.valueShort = 25;
	bean.valueCharType = 'a';
	bean.valueChar = 'a';
	bean.valueIntType = 12;
	bean.valueInt = 12;
	bean.valueLongType = 24;
	bean.valueLong = 24L;
	bean.valueFloatType = 24f;
	bean.valueFloat = 24f;
	bean.valueDoubleType = 24.0;
	bean.valueDouble = 24.0;
	bean.valueString = "\"ciao";
	
	return bean;
}
 
Example 7
Source Project: j2objc   File: G7CollationTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void TestG7Data() {
    Locale locales[] = {
            Locale.US,
            Locale.UK,
            Locale.CANADA,
            Locale.FRANCE,
            Locale.CANADA_FRENCH,
            Locale.GERMANY,
            Locale.JAPAN,
            Locale.ITALY
        };
    int i = 0, j = 0;
    for (i = 0; i < locales.length; i++) {
        Collator myCollation= null;
        RuleBasedCollator tblColl1 = null;
        try {
            myCollation = Collator.getInstance(locales[i]);
            tblColl1 = new RuleBasedCollator(((RuleBasedCollator)myCollation).getRules());
        } catch (Exception foo) {
            warnln("Exception: " + foo.getMessage() +
                  "; Locale : " + locales[i].getDisplayName() + " getRules failed");
            continue;
        }
        for (j = 0; j < FIXEDTESTSET; j++) {
            for (int n = j+1; n < FIXEDTESTSET; n++) {
                doTest(tblColl1, testCases[results[i][j]], testCases[results[i][n]], -1);
            }
        }
        myCollation = null;
    }
}
 
Example 8
Source Project: j2objc   File: GregorianCalendarTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * java.util.GregorianCalendar#GregorianCalendar(java.util.Locale)
 */
public void test_ConstructorLjava_util_Locale() {
    // Test for method java.util.GregorianCalendar(java.util.Locale)
    Date date = new Date();
    GregorianCalendar gcJapan = new GregorianCalendar(Locale.JAPAN);
    gcJapan.setTime(date);
    GregorianCalendar gcJapan2 = new GregorianCalendar(Locale.JAPAN);
    gcJapan2.setTime(date);
    GregorianCalendar gcItaly = new GregorianCalendar(Locale.ITALY);
    gcItaly.setTime(date);
    assertTrue("Locales not created correctly", gcJapan.equals(gcJapan2)
            && !gcJapan.equals(gcItaly));
}
 
Example 9
static void testFormatting() {
    boolean failed = false;
    Locale[] locales = {
        Locale.US,
        Locale.JAPAN,
        Locale.GERMANY,
        Locale.ITALY,
        new Locale("it", "IT", "EURO") };
    Currency[] currencies = {
        null,
        Currency.getInstance("USD"),
        Currency.getInstance("JPY"),
        Currency.getInstance("DEM"),
        Currency.getInstance("EUR"),
    };
    String[][] expecteds = {
        {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"},
        {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"},
        {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
    };

    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        for (int j = 0; j < currencies.length; j++) {
            Currency currency = currencies[j];
            String expected = expecteds[i][j];
            if (currency != null) {
                format.setCurrency(currency);
                int digits = currency.getDefaultFractionDigits();
                format.setMinimumFractionDigits(digits);
                format.setMaximumFractionDigits(digits);
            }
            String result = format.format(1234.56);
            if (!result.equals(expected)) {
                failed = true;
                System.out.println("FAIL: Locale " + locale
                    + (currency == null ? ", default currency" : (", currency: " + currency))
                    + ", expected: " + expected
                    + ", actual: " + result);
            }
        }
    }

    if (failed) {
        throw new RuntimeException();
    }
}
 
Example 10
static void testFormatting() {
    boolean failed = false;
    Locale[] locales = {
        Locale.US,
        Locale.JAPAN,
        Locale.GERMANY,
        Locale.ITALY,
        new Locale("it", "IT", "EURO") };
    Currency[] currencies = {
        null,
        Currency.getInstance("USD"),
        Currency.getInstance("JPY"),
        Currency.getInstance("DEM"),
        Currency.getInstance("EUR"),
    };
    String[][] expecteds = {
        {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"},
        {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"},
        {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
    };

    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        for (int j = 0; j < currencies.length; j++) {
            Currency currency = currencies[j];
            String expected = expecteds[i][j];
            if (currency != null) {
                format.setCurrency(currency);
                int digits = currency.getDefaultFractionDigits();
                format.setMinimumFractionDigits(digits);
                format.setMaximumFractionDigits(digits);
            }
            String result = format.format(1234.56);
            if (!result.equals(expected)) {
                failed = true;
                System.out.println("FAIL: Locale " + locale
                    + (currency == null ? ", default currency" : (", currency: " + currency))
                    + ", expected: " + expected
                    + ", actual: " + result);
            }
        }
    }

    if (failed) {
        throw new RuntimeException();
    }
}
 
Example 11
static void testFormatting() {
    boolean failed = false;
    Locale[] locales = {
        Locale.US,
        Locale.JAPAN,
        Locale.GERMANY,
        Locale.ITALY,
        new Locale("it", "IT", "EURO") };
    Currency[] currencies = {
        null,
        Currency.getInstance("USD"),
        Currency.getInstance("JPY"),
        Currency.getInstance("DEM"),
        Currency.getInstance("EUR"),
    };
    String[][] expecteds = {
        {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"},
        {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"},
        {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
    };

    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        for (int j = 0; j < currencies.length; j++) {
            Currency currency = currencies[j];
            String expected = expecteds[i][j];
            if (currency != null) {
                format.setCurrency(currency);
                int digits = currency.getDefaultFractionDigits();
                format.setMinimumFractionDigits(digits);
                format.setMaximumFractionDigits(digits);
            }
            String result = format.format(1234.56);
            if (!result.equals(expected)) {
                failed = true;
                System.out.println("FAIL: Locale " + locale
                    + (currency == null ? ", default currency" : (", currency: " + currency))
                    + ", expected: " + expected
                    + ", actual: " + result);
            }
        }
    }

    if (failed) {
        throw new RuntimeException();
    }
}
 
Example 12
static void testFormatting() {
    boolean failed = false;
    Locale[] locales = {
        Locale.US,
        Locale.JAPAN,
        Locale.GERMANY,
        Locale.ITALY,
        new Locale("it", "IT", "EURO") };
    Currency[] currencies = {
        null,
        Currency.getInstance("USD"),
        Currency.getInstance("JPY"),
        Currency.getInstance("DEM"),
        Currency.getInstance("EUR"),
    };
    String[][] expecteds = {
        {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"},
        {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"},
        {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
    };

    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        for (int j = 0; j < currencies.length; j++) {
            Currency currency = currencies[j];
            String expected = expecteds[i][j];
            if (currency != null) {
                format.setCurrency(currency);
                int digits = currency.getDefaultFractionDigits();
                format.setMinimumFractionDigits(digits);
                format.setMaximumFractionDigits(digits);
            }
            String result = format.format(1234.56);
            if (!result.equals(expected)) {
                failed = true;
                System.out.println("FAIL: Locale " + locale
                    + (currency == null ? ", default currency" : (", currency: " + currency))
                    + ", expected: " + expected
                    + ", actual: " + result);
            }
        }
    }

    if (failed) {
        throw new RuntimeException();
    }
}
 
Example 13
static void testFormatting() {
    boolean failed = false;
    Locale[] locales = {
        Locale.US,
        Locale.JAPAN,
        Locale.GERMANY,
        Locale.ITALY,
        new Locale("it", "IT", "EURO") };
    Currency[] currencies = {
        null,
        Currency.getInstance("USD"),
        Currency.getInstance("JPY"),
        Currency.getInstance("DEM"),
        Currency.getInstance("EUR"),
    };
    String[][] expecteds = {
        {"$1,234.56", "$1,234.56", "JPY1,235", "DEM1,234.56", "EUR1,234.56"},
        {"\uFFE51,235", "USD1,234.56", "\uFFE51,235", "DEM1,234.56", "EUR1,234.56"},
        {"1.234,56 \u20AC", "1.234,56 USD", "1.235 JPY", "1.234,56 DM", "1.234,56 \u20AC"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
        {"\u20AC 1.234,56", "USD 1.234,56", "JPY 1.235", "DEM 1.234,56", "\u20AC 1.234,56"},
    };

    for (int i = 0; i < locales.length; i++) {
        Locale locale = locales[i];
        NumberFormat format = NumberFormat.getCurrencyInstance(locale);
        for (int j = 0; j < currencies.length; j++) {
            Currency currency = currencies[j];
            String expected = expecteds[i][j];
            if (currency != null) {
                format.setCurrency(currency);
                int digits = currency.getDefaultFractionDigits();
                format.setMinimumFractionDigits(digits);
                format.setMaximumFractionDigits(digits);
            }
            String result = format.format(1234.56);
            if (!result.equals(expected)) {
                failed = true;
                System.out.println("FAIL: Locale " + locale
                    + (currency == null ? ", default currency" : (", currency: " + currency))
                    + ", expected: " + expected
                    + ", actual: " + result);
            }
        }
    }

    if (failed) {
        throw new RuntimeException();
    }
}
 
Example 14
Source Project: kripton   File: Test76Attribute.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Test run.
 *
 * @throws Exception the exception
 */
//@Test
public void testRun() throws Exception
{
	//Assert.assertNotNull(new BeanAttribute76BindMap());
	
	BeanAttribute76 bean=new BeanAttribute76();
	
	bean.valueBigDecimal=BigDecimal.valueOf(11.0);
	bean.valueBigInteger=BigInteger.valueOf(10);
	bean.valueEnum=BeanEnum.VALUE_2;
	bean.valueCalendar=Calendar.getInstance();
	bean.valueCurrency=Currency.getInstance(Locale.ITALY);
	bean.valueDate=new Date();
	bean.valueLocale=Locale.ITALY;
	bean.valueTime=new Time(0);
	bean.valueTimeZone=TimeZone.getDefault();
	bean.valueUrl=new URL("http://github.com");
	bean.id=25;
	bean.valueBean=new BeanAttribute76();
	bean.valueBean.id=45;
	bean.valueBoolType=true;
	bean.valueBool=true;
	bean.valueByteType=4;
	bean.valueByte=8;
	bean.valueShortType=25;
	bean.valueShort=25;
	bean.valueCharType='a';
	bean.valueChar='a';
	bean.valueIntType=12;
	bean.valueInt=12;
	bean.valueLongType=24;
	bean.valueLong=24L;
	bean.valueFloatType=24f;
	bean.valueFloat=24f;
	bean.valueDoubleType=24.0;
	bean.valueDouble=24.0;
	bean.valueString="\"ciao";
	
	check(bean);
}
 
Example 15
public void testDateFormat( )
{
	ReportParameterConverter rpc;
	Calendar dateCal;
	Date date;
	Locale locale = Locale.ITALY;
	
	dateCal = Calendar.getInstance( );
	dateCal.set( 1998, 8, 13, 20, 1, 44 );
	date = dateCal.getTime( );
	rpc = new ReportParameterConverter( "MM/dd/yy KK:mm aa", locale );
	assertEquals( "09/13/98 08:01 PM", rpc.format( date ) );
	rpc = new ReportParameterConverter( "Long Date", locale );
	assertEquals( "13 settembre 1998", rpc.format( date ) );

	locale = Locale.US;
	dateCal = Calendar.getInstance( );
	dateCal.set( 1998, 8, 13, 20, 1, 44 );
	date = dateCal.getTime( );
	rpc = new ReportParameterConverter( "MM/dd/yyyy hh:mm:ss a", locale );
	assertEquals( "09/13/1998 08:01:44 PM", rpc.format( date ) );

	// test the instance of locale
	dateCal = Calendar.getInstance( );
	dateCal.set( 1998, 8, 13, 20, 1, 44 );
	date = dateCal.getTime( );

	rpc = new ReportParameterConverter( "Long Date", locale );
	assertEquals( "September 13, 1998", rpc.format( date ) );
	rpc = new ReportParameterConverter( "D", locale );
	assertEquals( "September 13, 1998", rpc.format( date ) );
	rpc = new ReportParameterConverter( "Medium Date", locale );
	assertEquals( "Sep 13, 1998", rpc.format( date ) );
	rpc = new ReportParameterConverter( "Short Date", locale );
	assertEquals( "9/13/98", rpc.format( date ) );
	rpc = new ReportParameterConverter( "d", locale );
	assertEquals( "9/13/98", rpc.format( date ) );
	rpc = new ReportParameterConverter( "Long Time", locale );
	assertEquals( true, rpc.format( date ).startsWith( "8:01:44 PM" ) );
	rpc = new ReportParameterConverter( "T", locale );
	assertEquals( true, rpc.format( date ).startsWith( "8:01:44 PM" ) );

	/* icu and java are not synced.
	SimpleDateFormat javaSample = (SimpleDateFormat) java.text.DateFormat
			.getDateTimeInstance( java.text.DateFormat.LONG,
					java.text.DateFormat.SHORT, locale.toLocale( ) );
	rpc = new ReportParameterConverter( "f", locale );
	assertEquals( javaSample.format( date ), rpc.format( date ) );
	*/

	rpc = new ReportParameterConverter( "General Date", locale );
	assertEquals( true, rpc.format( date ).startsWith(
			"September 13, 1998 at 8:01:44 PM PDT" ) );
	rpc = new ReportParameterConverter( "Short Time", locale );
	assertEquals( "20:01", rpc.format( date ) );
	rpc = new ReportParameterConverter( "Medium Time", locale );
	assertEquals( "8:01:44 PM", rpc.format( date ) );
}
 
Example 16
public void testParseToDate( )
{
	Locale locale = Locale.US;
	ReportParameterConverter rpc;
	Calendar dateCal;
	Date date;

	dateCal = Calendar.getInstance( );
	dateCal.clear( );
	dateCal.set( 1998, 8, 13, 20, 1, 0 );
	date = dateCal.getTime( );
	locale = Locale.ITALY;
	rpc = new ReportParameterConverter( "MM/dd/yy KK:mm aa", locale );
	assertEquals( date, rpc.parse( "09/13/98 08:01 pm",
			IScalarParameterDefn.TYPE_DATE_TIME ) );

	locale = Locale.US;
	dateCal = Calendar.getInstance( );
	dateCal.clear( );
	dateCal.set( 1998, 8, 13, 0, 0, 0 );
	date = dateCal.getTime( );
	locale = Locale.ITALY;
	rpc = new ReportParameterConverter( "Long Date", locale );
	assertEquals( date, rpc.parse( "13 settembre 1998",
			IScalarParameterDefn.TYPE_DATE_TIME ) );

	locale = Locale.US;
	dateCal = Calendar.getInstance( );
	dateCal.clear( );
	dateCal.set( 1998, 8, 13, 20, 1, 44 );
	date = dateCal.getTime( );
	rpc = new ReportParameterConverter( "MM/dd/yyyy hh:mm:ss a", locale );
	assertEquals( date, rpc.parse( "09/13/1998 08:01:44 PM",
			IScalarParameterDefn.TYPE_DATE_TIME ) );
	
	String date1 = "2005/05/06 03:45:25";
	ReportParameterConverter converter = new ReportParameterConverter( "yyyy/MM/dd hh:mm:ss", Locale.US );
	assertEquals( "2005-05-06", converter.parse( date1,
			IScalarParameterDefn.TYPE_DATE ).toString( ) );
	assertEquals( "03:45:25", converter.parse( date1,
			IScalarParameterDefn.TYPE_TIME ).toString( ) );
}
 
Example 17
@Test
public void validValue() {
    LocaleKeyValueItem victim = new LocaleKeyValueItem(Locale.ITALY);
    assertEquals(StringUtils.capitalize(Locale.ITALY.getDisplayName()), victim.getValue());
    assertEquals(Locale.ITALY.toLanguageTag(), victim.getKey());
}
 
Example 18
Source Project: jphp   File: WrapLocale.java    License: Apache License 2.0 4 votes vote down vote up
@Signature
public static Memory ITALY(Environment env, Memory... args) {
    return new ObjectMemory(new WrapLocale(env, Locale.ITALY));
}