This repository has been archived by the owner on Dec 3, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Creates incorrect MD5 hash for some files (#103)
* [core] Add test file that we create incorrect hash for By 'incorrect' we mean "not what AWS S3 think is correct" for this file. * [domain] HexEncoder rewritten to correctly decode hex * [domain] HexEncoder encode to uppercase
- Loading branch information
Showing
3 changed files
with
33 additions
and
12 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
domain/src/test/scala/net/kemitix/thorp/domain/HexEncoderTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package net.kemitix.thorp.domain | ||
|
||
import java.nio.charset.StandardCharsets | ||
|
||
import org.scalatest.FreeSpec | ||
|
||
class HexEncoderTest extends FreeSpec { | ||
|
||
val text = "test text to encode to hex" | ||
val hex = "74657374207465787420746F20656E636F646520746F20686578" | ||
|
||
"can round trip a hash decode then encode" in { | ||
val input = hex | ||
val result = HexEncoder.encode(HexEncoder.decode(input)) | ||
assertResult(input)(result) | ||
} | ||
"can round trip a hash encode then decode" in { | ||
val input = hex.getBytes(StandardCharsets.UTF_8) | ||
val result = HexEncoder.decode(HexEncoder.encode(input)) | ||
assertResult(input)(result) | ||
} | ||
|
||
} |