"And these are the nations that the LORD left, to test Israel by them" (Judges 3:1). This is what is written: "You have given a banner to those who fear You, to be raised up" (Psalms 60:6) - a refuge, so that Israel may be saved from the judgment of Gehinnom. Why? "Because of truth, selah" (Psalms 60:6) - in order to give them their reward in truth, as it is said, "And I will give their recompense in truth" (Isaiah 61:8). But the wicked have no refuge, as it is said, "And the eyes of the wicked shall fail, and refuge shall perish from them" (Job 11:20). Come and see the difference between the earlier ones and the later ones: the earlier ones were tested by the hand of the Holy One, blessed be He - "And God tested Abraham" (Genesis 22:1); and so too the generation of the wilderness, "that I may test them" (Exodus 16:4), and "in order to test you" (Deuteronomy 8:16). But the later ones were tested by the hand of the nations, as it is said, "These are the nations that the LORD left to test Israel" - to know who does His will in truth, because of truth, selah. And so you find with Daniel and his companions: when they were exiled, the Holy One, blessed be He, had decreed and said, "So shall the children of Israel eat their bread unclean among the nations" (Ezekiel 4:13). Nebuchadnezzar arose and fulfilled the matter; he began to say, "Let it be decreed that they eat of my provision," as it is said, "And the king appointed for them a daily portion" (Daniel 1:5). Daniel did not accept it upon himself. The Holy One, blessed be He, said: He seeks to test us, who are the children of the children of Abraham our father, who was tested with ten trials - perhaps his merit will stand for us. He began to say to the chief of the eunuchs, "Test, please, your servants ten days" (Daniel 1:12) - did the king not already find us tenfold, as it is said, "And he found them ten times better" (Daniel 1:20)?
The Banner of Testing and Daniel's Ten Days
Yalkut Shimoni on Nach 41:2
ואלה הגוים אשר הניח ה' לנסות בם את ישראל. הה"ד ננתתה ליראיך נס להתנוסס מנוס שינצלו ישראל מדינה של גיהנם למה מפני קשט סלה כדי ליתן שכרם בקשט שנאמר ונתתי פעולתם באמת, אבל הרשעים אין להם מנוס שנאמר ועיני רשעים תכלינה ומנוס אבד מנהם. בוא וראה מה בין ראשונים לאחרונים שהראשונים היו מתנסים ביד הקב"ה והאלהים נסה את אברהם, וכן דור המדבר למען אנסנו, ולמען נסותך. אבל האחרונים נסנסו ביד האומות שנאמר ואלה הגוים אשר הניח ה' לנסות בם את ישראל, לידע מי עושה רצונו באמת מפני קשט סלה. וכן אתה מוצא בדניאל וחבריו כשגלו גזר הקב"ה ואמר ככה יאכלו בני ישראא את לחמם טמא בגוים. עמד נבוכדנאצר וקיים את הדבר התחיל לומר גזורני שיהיו אוכלים מן אנונה שלי שנאמר וימן להם המלך דבר יום ביומו, דניאל לא קבל עליו, אמר הקב"ה בקש לנסות אותנו שאנו מבני בניו של אברהם אבינו שנתנסה בעשר נסיונות שמא זכותו תעמוד לנו התחיל לומר לשר הסריסים נס וגו' נס נא עבדיך ימים עשרה לא כבר מצא בנו המלך עשר ידות שנאמר וימצאם עשר ידות: