// make a couple of nearly spaced calls
// (Note: 'Z' is JDK 1.4, using 'z' instead.)
Locale thai = new Locale("th", "TH");
SimpleDateFormat baseFormat =
new SimpleDateFormat("EEE, MMM dd, HH:mm:ss.SSS z", thai);
DateFormat cachedFormat = new CachedDateFormat(baseFormat, 1000);
//
// use a date in the year 2000 CE to attempt to confuse the millisecond locator
long ticks = 11141L * 86400000L;
String sx;
Date jul1 = new Date(ticks);
sx = cachedFormat.format(jul1);
System.out.println(baseFormat.format(jul1));
System.out.println(sx);
assertEquals(baseFormat.format(jul1), sx);
sx = cachedFormat.format(jul1);
System.out.println(baseFormat.format(jul1));
System.out.println(sx);
assertEquals(baseFormat.format(jul1), sx);
Date plus8ms = new Date(ticks + 8);
sx = cachedFormat.format(plus8ms);
System.out.println(baseFormat.format(plus8ms));
System.out.println(sx);
assertEquals(baseFormat.format(plus8ms), sx);
Date plus17ms = new Date(ticks + 17);
assertEquals(baseFormat.format(plus17ms), cachedFormat.format(plus17ms));
Date plus237ms = new Date(ticks + 237);
assertEquals(baseFormat.format(plus237ms), cachedFormat.format(plus237ms));
Date plus1415ms = new Date(ticks + 1415);
assertEquals(baseFormat.format(plus1415ms), cachedFormat.format(plus1415ms));
}