This is the way how we have to understand the accounts of trials; we must not think that God desires to examine us and to try us in order to know what He did not know before. Far is this from Him; He is far above that which ignorant and foolish people imagine concerning Him, in the evil of their thoughts. Note this.
Ch.24 - Guide for the Perplexed (c. 1190) - Part III