0

We have a component which works based on the current date in following manner (kind of recurring manner).

  1. pick something eligible for today.
  2. do some processing on it (this again involves code having logic on current date).
  3. update parameters for next round (i.e. when it should be picked and other dates).

So basically there are multiple services doing different things, and depends on current date.

Now we want to write integration test cases for this whole component. In order to do that we create one object (lets assume it will have 4 rounds before it hit the end of road).

So can you please help us how should we go about it?

  1. have a different service for current date, and use it everywhere in the whole system. Mock it/ initialize with the required date while doing integration testing.
  2. some other suggestion.

Thanks

  • This question may already have an answer here: http://stackoverflow.com/q/2425721/126014 However, since you don't write which technology stack you're on, I'll refrain from marking this question as a true duplicate. HTH. – Mark Seemann Apr 25 '14 at 06:15
  • Thanks for pointing there, we are on java stack. It's almost similar to what we had in point # 1 above. I was thinking if there is some other better way to do it. – anil.maheshwari Apr 25 '14 at 09:05

0 Answers0