There are two reasons for things to happen either as Tests or Punishments. Both are equally good. The former, if you pass you will get a great reward and the latter, it will wash your sin away. It is important to stay positive and optimistic no matter what happens.
Hanita 2019