God knows the person whom He is testing and is confident that the outcome will be for the good.
As a certain Midrash teaches: just as the potter knocks on the newly completed vessel to ascertain if it is sound, so does God knock on a man.
A potter will refrain from knocking on an obviously cracked vessel; it would only break.
He tests the pots that are whole.
It is men who are relatively unblemished and complete who are tested, and this in order to bring them to a greater knowledge of Divine presence.
Before the test a person does not always have the assurance of his worth.
The test of suffering enables one to see more clearly.
The struggle to overcome deepens the inner forces of life and augments the capacity
to understand.
–Rabbi Adin Steinsaltz
From “The Trials of Life” in The Candle of God by Rabbi Adin Steinsaltz