better unit test and more robust integration test