Test refactoring, exception message encoding