DateFormat df = new SimpleDateFormat(pattern); // format() should not throw AIOOB exception
String result = df.format(new Date());
// Since the tested format patterns do not contain any character // representing date/time field, those characters are not interpreted, // they are simply copied into the output string during formatting
assertEquals(result, pattern, "Failed to format the date using"
+ " pattern of length: " + length);
// The format pattern used by this SimpleDateFormat // contains a sequence of non-ASCII characters, which does not // represent any date/time field. The same sequence is given // for parsing, just to check that the parsing does // not throw any AIOOB exception. // Although as per the parse() specification, the calendar's default // values of the date-time fields are used for any missing // date-time information, but checking that is not the intention of // this test.
df.parse(pattern);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.