added cast function for timestamp type

expectedException is unused?