unit test for Prepare