Implement builder pattern for tests.

I've updated the tests to use the builder pattern.
/cc @senny @maethu