Simplify test by using spy.