The criterion for thinking well of Allah [Husn az-Zan]:
Ibn al-Qayim (may Allah have mercy on him) said: "Thinking well of Allah or Raja' manifests itself in believing in the means of salvations granted by Allah and not otherwise. Meaning, if a person excessively commits sins depending on Allah's forgiveness, mercy which precedes His wrath, it must be said that Allah is above all of this thinking. Allah is Ever-Wise in His decree. Allah is the Ever-Wise; He is above His creation and the Ever- Avenger who sends His wrath upon those who deserve it. Therefore, if thinking well of Allah is attributed to His Names and Attributes, thus righteous and immoral; believer and disbeliever, His Wali [friend of Allah] and enemies will be alike in the sight of Allah. Therefore, a tyrant immoral person will never attain Allah's mercy and forgiveness while Allah Has decreed torture for Him and engulfed him with His wrath. Such a person who committed sins, exceeded the limits of Allah and violated His prohibitions deserves nothing except Allah's wrath. On the contrary, thinking well of Allah benefits a person who sincerely repents and determine not to return to sins and to spend the rest of his life in goodness, obedience and righteousness. Then, such a repentant hopes to attain mercy through thinking well of Him. This is typically what Husn Az-Zan means, while the first case is known as deception. Allah is the Best Supporter".
Al-Jawab al-Kafi pages 76-77.