CommandProcessor: refactor fake Write() in unit tests am: 79ba4b28b6
am: 2673ad4bfe

Change-Id: I7e0d024a7692855dc134e91c1cb25951808f1797