Added encoding dance for test utilities and added a test