add unit test functionality into code