Refactored TokenTest to rely on TokenFactory
Added parameter checks to TokenEncoder constructor