You're going about this the wrong way. Your class methods should be accepting a long
value which represents the time - they should not be accepting a TimeZone
. If you refactor your methods to be decoupled from the fact that they receive there 'time' from a TimeZone
, then you can easily test your methods without having to do what you're trying to do now; you simply call your methods with pre-defined long
values representative of a particular time, rather then calling them with a TimeZone
object whose default value is something predetermined that you wish to test.
You need to decouple the methods which receive a 'time' parameter from the source which provides that time value. By doing this, you can run your code while using TimeZone
or the current system time, and you can test your code while using predefined time values that you wish to test.
Go ahead and try refactoring your code and see if you can achieve the desired capabilities - you should be able to. Come back with any further questions and we'll be glad to help!
Good luck.