Extracts java call in a function so it can be mocked
Renames `token-valid?` in `valid-token?`
Extract the retrieval of the user so it can be mocked
Adds more tests