assertEquals(testResult.toString(), result.toString());
}
public void testTextWithDateFormatSecondArg() {
// Test with Java style M=Month
ValueEval numArg = new NumberEval(321.321);
ValueEval formatArg = new StringEval("dd:MM:yyyy hh:mm:ss");
ValueEval[] args = { numArg, formatArg };
ValueEval result = T.TEXT.evaluate(args, -1, (short)-1);
ValueEval testResult = new StringEval("16:11:1900 07:42:14");
assertEquals(testResult.toString(), result.toString());
// Excel also supports "m before h is month"
formatArg = new StringEval("dd:mm:yyyy hh:mm:ss");
args[1] = formatArg;
result = T.TEXT.evaluate(args, -1, (short)-1);
testResult = new StringEval("16:11:1900 07:42:14");
assertEquals(testResult.toString(), result.toString());
// this line is intended to compute how "November" would look like in the current locale
String november = new SimpleDateFormat("MMMM").format(new GregorianCalendar(2010,10,15).getTime());
// Again with Java style
formatArg = new StringEval("MMMM dd, yyyy");
args[1] = formatArg;
result = T.TEXT.evaluate(args, -1, (short)-1);
testResult = new StringEval(november + " 16, 1900");
assertEquals(testResult.toString(), result.toString());
// And Excel style
formatArg = new StringEval("mmmm dd, yyyy");
args[1] = formatArg;
result = T.TEXT.evaluate(args, -1, (short)-1);
testResult = new StringEval(november + " 16, 1900");
assertEquals(testResult.toString(), result.toString());
}