Improve test code

Change-Id: I196a7f654bf8f061a4b050ea1fbe01fae9f450c2