Why were they suprised?

A teacher announces to her class that there will be a surprise test sometime during the following week. The students begin to speculate about when it might occur, until one of them announces that there is no reason to worry, because a surprise test is impossible. The test cannot be given on Friday, she says, because by the end of the day on Thursday we would know that the test must be given the next day. Nor can the test be given on Thursday, she continues, because, given that we know that the test cannot be given on Friday, by the end of the day on Wednesday we would know that the test must be given the next day. And likewise for Wednesday, Tuesday, and Monday. The students spend a restful weekend not studying for the test, and they are all surprised when it is given on Wednesday. How could this happen?