df = DateFormat.getDateInstance( DateFormat.SHORT, locale );
df = DateFormat.getDateInstance( DateFormat.SHORT, locale.toLocale( ) );
	public void testCheckValid( )	{		ULocale locale;		DateFormat df;			String dateStr;		boolean isValid;				// ------------test of Locale.UK		locale = ULocale.UK; //dd/MM/yy				df = DateFormat.getDateInstance( DateFormat.SHORT, locale );				dateStr = "25/11/16 ";		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertTrue( isValid );				dateStr = "25/11/6 ";		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertTrue( isValid );				dateStr = "2005/11/16 "; // invalid dd		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				// ------------test of Locale.US		locale = ULocale.US; //MM/dd/yy		df = DateFormat.getDateInstance( DateFormat.SHORT, locale );				dateStr = "11/25/16";		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertTrue( isValid );				dateStr = "21/11/6"; // invalid MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				dateStr = "2005/11/6"; // invalid MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				dateStr = "11/44/16"; // invalid dd		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				dateStr = "11/31/1990"; // invalid dd to MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				dateStr = "02/29/1990"; // invalid dd to MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				dateStr = "02/28/1990"; // invalid dd to MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertTrue( isValid );				// ------------test of Locale.CHINA		locale = ULocale.CHINA; //yy-M-d		df = DateFormat.getDateInstance( DateFormat.SHORT, locale );				dateStr = "2005-3-3";		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertTrue( isValid );				dateStr = "2005-13-6"; // invalid MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				dateStr = "2005-11-36"; // invalid dd		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );		assertFalse( isValid );				dateStr = "5-13-2005"; // invalid dd		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );				assertFalse( isValid );				dateStr = "2005-11-31"; // invalid dd to MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );				dateStr = "2005-2-29"; // invalid dd to MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );				assertFalse( isValid );				dateStr = "2005-2-28"; // invalid dd to MM		try		{			df.parse( dateStr );		}		catch ( ParseException e )		{			fail("can not reach here");		}		isValid = DateUtil.checkValid( df, dateStr );				assertTrue( isValid );		}