Remove duplicated code for automock