Fix test generation and tets mocking