Can company post advertisement for a job, interview people and have them take a test then give the job back to the person that was leaving the company
There is nothing in your post to indicate you have a legal issue. That is a company hiring decision.