### Question:
SimpleTimestampFormat extends SimpleDateFormat { @Override public String toLocalizedPattern() { if ( compatibleToSuperPattern ) { return super.toLocalizedPattern(); } else { StringBuffer pattern = new StringBuffer( super.toLocalizedPattern() ); int placeholderPosition = replaceHolder( pattern, true ); for ( int i = placeholderPosition; i <= endNanosecondPatternPosition - startNanosecondPatternPosition + placeholderPosition; i++ ) { pattern.insert( i, patternNanosecond ); } return pattern.toString(); } } SimpleTimestampFormat( String pattern );  SimpleTimestampFormat( String pattern, Locale locale );  SimpleTimestampFormat( String pattern, DateFormatSymbols formatSymbols ); @Override void setDateFormatSymbols( DateFormatSymbols newFormatSymbols ); @Override StringBuffer format( Date timestamp, StringBuffer toAppendTo, FieldPosition pos ); @Override AttributedCharacterIterator formatToCharacterIterator( Object obj ); @Override Date parse( String text, ParsePosition pos ); @Override String toPattern(); @Override String toLocalizedPattern(); @Override void applyPattern( String pattern ); @Override void applyLocalizedPattern( String pattern ); @Override Date parse( String source ); @Override Object parseObject( String source, ParsePosition pos ); static final String DEFAULT_TIMESTAMP_FORMAT; }### Answer:
@Test public void testToLocalizedPattern() throws Exception { for ( Locale locale : locales ) { Locale.setDefault( Locale.Category.FORMAT, locale ); tdb = ResourceBundle.getBundle( "org/pentaho/di/core/row/value/timestamp/messages/testdates", locale ); SimpleTimestampFormat stf = new SimpleTimestampFormat( new SimpleDateFormat().toPattern() ); assertEquals( locale.toLanguageTag(), tdb.getString( "PATTERN.LOCALE.COMPILED" ), stf.toLocalizedPattern() ); String patternExample = tdb.getString( "PATTERN.KETTLE" ); stf = new SimpleTimestampFormat( patternExample ); assertEquals( locale.toLanguageTag(), tdb.getString( "PATTERN.LOCALE.COMPILED_DATE" ), stf.toLocalizedPattern() ); } }
@Test public void testToLocalizedPattern() throws Exception { for ( Locale locale : locales ) { Locale.setDefault( Locale.Category.FORMAT, locale ); tdb = ResourceBundle.getBundle( "org/apache/hop/core/row/value/timestamp/messages/testdates", locale ); SimpleTimestampFormat stf = new SimpleTimestampFormat( new SimpleDateFormat().toPattern() ); assertEquals( locale.toLanguageTag(), tdb.getString( "PATTERN.LOCALE.COMPILED" ), stf.toLocalizedPattern() ); String patternExample = tdb.getString( "PATTERN.HOP" ); stf = new SimpleTimestampFormat( patternExample ); assertEquals( locale.toLanguageTag(), tdb.getString( "PATTERN.LOCALE.COMPILED_DATE" ), stf.toLocalizedPattern() ); } }