This is from a book written by Catherine of Siena … I have used this method and found it useful. In general I have found her to be a treasure to read.
God speaking to St. Catherine in a vision:
If it is the devil who has come to visit the mind under the guise of light, the soul experiences gladness at his coming. But the longer he stays, the more gladness gives way to weariness and darkness and pricking as the mind becomes clouded over by his presence within. But when the soul is truly visited by me, eternal Truth, she experiences holy fear at the first encounter. And with this fear comes gladness and security, along with a gentle prudence that does not doubt even while it doubts, but through self-knowledge considers itself unworthy. So the soul says, “I am not worthy to receive your visitation – but how can I be worthy?” Then she turns to the greatness of my charity, knowing and seeing that I can grant it. For I look not to her unworthiness but to my worth, and so make her worthy to receive me. For I do not scorn the longing with which she calls to me. Then she receives my visitation humbly, saying, “Behold your servant: Let your will be done in me.” Then she emerges from the course of prayer and to my visitation with spiritual gladness and joy, in humility considering herself unworthy, and in charity acknowledging that it was from me.
This then is how the soul can tell whether she is being visited by me or by the devil: In my visitation she will find fear at the beginning; but in the middle and at the end, gladness and a hunger for virtue. When it is the devil, however, the beginning is happy, but then the soul is left in spiritual confusion and darkness. Now I have warned you by giving you the sign, so that the soul, if she chooses to behave humbly and prudently, cannot be deluded. The one deluded will be the soul who chooses to travel only with the imperfect love of her own consolation rather than of my affection.
(pp. 133-134)
Catherine of Siena. Catherine of Siena: The Dialogue.Trans. Suzanne Noffke, O.P. Mahwah, New Jersey: Paulist Press, 1980.
ISBN 0809122332