Refactoring lexical test