Judges 2:22
2:22 Joshua left those nations to test Israel. I wanted to see whether or not the people would carefully walk in the path marked out by the Lord, as their ancestors were careful to do.”
Judges 3:2
3:2 He left those nations simply because he wanted to teach the subsequent generations of Israelites, who had not experienced the earlier battles, how to conduct holy war.