Reputation: 611
I have such problem. I'm writing integration tests for my app. In the app I send some mails for the users. When I create email I use Velocity templates. Example of template:
Hi ${user}!
Example of mail:
Hi User!
When I write my integration tests I want to parse parameters from received emails. If I have velocity template and mail which was created with using of this template. I want such method
Map<String,String> getParameters(velocityTemplate, mailBody);
How I can parse parameters from emails text?
Upvotes: 4
Views: 9291
Reputation: 19684
If your question is like Velocity (VM) template request parameters: Getting GET variables then the answer is:
$httpUtil.getParameterMap($httpUtil.getQueryString($request.attributes.CURRENT_URL))
or, as it turns out:
$request.getParameterMap($request.getQueryString($request.attributes.CURRENT_URL))
Upvotes: 1