Update API, use mock to replace flexmock