There was an entertaining end to the second day of testing as Lewis Hamilton impressed in his Mercedes.