Skip to content

Commit

Permalink
[vividus] Add hash expression unit test for argument with commas
Browse files Browse the repository at this point in the history
  • Loading branch information
EDbarvinsky committed Nov 28, 2022
1 parent c054e73 commit 4317737
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/modules/commons/pages/expressions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,16 @@ Calculates the hash using the specified hashing algorithm
* *`$algorithm`* - {algorithm-summary}
* *`$input`* - any string to calculate hash

TIP: Since the hashing argument of the expression can include commas do not escape them using `\`.

.Example of hash calculating for string using MD5
|===
|Expression |Result

|`#{calculateHash(MD5, vividus)}`
|`0a05ba6064ae7e5d6ee9818f85b666ad`
|`#{calculateHash(sha256, do,not,escape,commas)}`
|`a137d0e9729765d5f41dce3a386454e043bbe94e82b017f42661a4b7403dae4c`
|===

=== `calculateFileHash`
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2019-2021 the original author or authors.
* Copyright 2019-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -40,6 +40,7 @@ public class HashExpressionProcessorTests
// CHECKSTYLE:OFF
"'calculateHash(SHA-1, a_tylmarande@gmail.com)', 025623becec96e8be6b88a7db6e0dc97fa0033ba",
"'calculateHash(Sha-256, a_tylmarande@gmail.com)', b4e73a7c815bb0eff534ba8ef5f7dbfe9d4f51f449cd9b2ba87fc57ee9de5fc7",
"'calculateHash(SHA256, reg,exp,works)', 1ce5cd2ea218c8d28748216c4a7c9bb51fc4d8c4fafd8d91d4edb8b1f9bd06a4",
"'calculateHash(md2, a_tylmarande@gmail.com)', 69ccf551ef37e2cf0181c97fcb7db030",
"'calculateHash(MD5, a_tylmarande@gmail.com)', 7b2378863e837c51c83bb04e66a5876d",
"'calculateHash(SHA-384, a_tylmarande@gmail.com)', 397bf1d877dead00a0e91cf27a2b561eff0736fbc05640580c2e541a42f99a61cc7bdd4f3fdc6c1ef7a614e6cac06415",
Expand Down

0 comments on commit 4317737

Please sign in to comment.